<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>收银台</title>
</head>
<link rel="stylesheet" href="__CDN__/assets/libs/bootstrap-table/dist/bootstrap-table.min.css">
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="__CDN__/assets/libs/fastadmin-layer/src/layer.js"></script>
<body>
<div class="content">
    <div class="left">
        <div>
            <img src="../../../../uploads/20241210/47259cc513902068b39e33da2c6a5b36.png" alt=""
                 style="width: 100px;height: 100px;">
        </div>
        <div class="leftbtn active sell" data-type="good">
            <svg t="1733899561670" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
                 p-id="4314" width="40" height="40">
                <path d="M694.26516 286.98827 512 469.254453 329.732793 286.98827c-8.287757-8.287757-21.724791-8.286734-30.012547 0.001023-8.286734 8.286734-8.286734 21.723767 0 30.011524l161.04486 161.043836-108.634186 0c-11.720949 0-21.221324 9.502421-21.221324 21.221324s9.501398 21.221324 21.221324 21.221324l139.000797 0 0 89.12997L363.803773 609.617271c-11.720949 0-21.221324 9.502421-21.221324 21.221324s9.501398 21.221324 21.221324 21.221324l127.328967 0 0 131.572618c0 11.718903 9.502421 21.221324 21.221324 21.221324s21.221324-9.502421 21.221324-21.221324L533.575388 652.059919l127.327944 0c11.719926 0 21.221324-9.502421 21.221324-21.221324S672.623257 609.617271 660.903332 609.617271L533.575388 609.617271l0-89.12997 138.999774 0c11.719926 0 21.221324-9.502421 21.221324-21.221324s-9.502421-21.221324-21.221324-21.221324L563.233871 478.044654l161.043836-161.043836c8.287757-8.287757 8.287757-21.724791 0-30.012547C715.987904 278.700513 702.554964 278.700513 694.26516 286.98827z"
                      fill="#cccccc" p-id="4315"></path>
                <path d="M512 65.290005c-246.316965 0-446.709995 200.39303-446.709995 446.708971 0 246.316965 200.39303 446.709995 446.709995 446.709995s446.709995-200.39303 446.709995-446.709995C958.709995 265.683035 758.316965 65.290005 512 65.290005zM512 916.266323c-222.913952 0-404.267347-181.353394-404.267347-404.267347S289.086048 107.733677 512 107.733677s404.267347 181.352371 404.267347 404.266323S734.912929 916.266323 512 916.266323z"
                      fill="#cccccc" p-id="4316"></path>
            </svg>
            <!--            <img src="../../../../uploads/20241210/money.png" alt="">-->
            <div>商品</div>
        </div>
        <div class="leftbtn sell" data-type="service">
            <svg t="1733900229778" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
                 p-id="8919" width="40" height="40">
                <path d="M352 224C371.2 224 384 211.2 384 192L384 96C384 76.8 371.2 64 352 64 332.8 64 320 76.8 320 96L320 192C320 211.2 332.8 224 352 224zM704 224c19.2 0 32-12.8 32-32L736 96C736 76.8 723.2 64 704 64c-19.2 0-32 12.8-32 32L672 192C672 211.2 684.8 224 704 224zM864 864c0 19.2-12.8 32-32 32L192 896c-19.2 0-32-12.8-32-32L160 384l704 0L864 864zM844.8 128l-44.8 0C780.8 128 768 140.8 768 160 768 179.2 780.8 192 800 192l44.8 0c6.4 0 19.2 12.8 19.2 32L864 320l-704 0L160 224C160 204.8 172.8 192 192 192l64 0c19.2 0 32-12.8 32-32C288 140.8 275.2 128 256 128L192 128C140.8 128 96 172.8 96 224l0 640C96 915.2 140.8 960 192 960l640 0c51.2 0 96-44.8 96-96l0-640C928 172.8 889.6 128 844.8 128zM448 192l160 0C627.2 192 640 179.2 640 160 640 140.8 627.2 128 608 128L448 128C428.8 128 416 140.8 416 160 416 179.2 428.8 192 448 192zM256 768l512 0c19.2 0 32-12.8 32-32 0-19.2-12.8-32-32-32L256 704c-19.2 0-32 12.8-32 32C224 755.2 236.8 768 256 768zM256 576l512 0c19.2 0 32-12.8 32-32C800 524.8 787.2 512 768 512L256 512C236.8 512 224 524.8 224 544 224 563.2 236.8 576 256 576z"
                      fill="#cccccc" p-id="8920"></path>
            </svg>
            <div>服务</div>
        </div>
        <div class="leftbtn sell" data-type="card">
            <svg t="1733900329381" class="icon" viewBox="0 0 1331 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
                 p-id="11303" width="40" height="40">
                <path d="M1204.375793 1023.998976H126.82221a127.846208 127.846208 0 0 1-89.702266-36.351945 124.159814 124.159814 0 0 1-27.135959-39.475141A121.395018 121.395018 0 0 1 0 899.839162V124.160326c0-16.742375 3.379195-33.02395 9.983985-48.332728C16.383975 61.03082 25.497562 47.77004 37.119944 36.352457A127.846208 127.846208 0 0 1 126.82221 0.000512h1077.553583a127.846208 127.846208 0 0 1 89.651066 36.351945c11.673582 11.417583 20.787169 24.678363 27.187159 39.475141 6.60479 15.308777 9.983985 31.590353 9.983985 48.332728v775.678836c0 16.742375-3.379195 33.02395-9.983985 48.332728a126.61741 126.61741 0 0 1-67.481499 66.047901c-15.615977 6.50239-32.255952 9.779185-49.356726 9.779185zM126.82221 62.157219c-34.918348 0-63.334305 27.801558-63.334305 62.003107v775.678836c0 34.201549 28.415957 62.003107 63.334305 62.003107h1077.553583c34.918348 0 63.334305-27.801558 63.334305-62.003107V124.160326c0-34.201549-28.415957-62.003107-63.334305-62.003107H126.82221zM31.743952 278.323295h1267.710099v63.999904H31.743952v-63.999904z m1173.65584 622.539866h-413.08098v-250.265225h413.08098v250.265225z m-349.593076-62.156707h286.105171v-125.951811h-286.105171v125.951811z"
                      fill="#cccccc" p-id="11304"></path>
            </svg>
            <div>卡项</div>
        </div>
    </div>
    <div class="con"  id="good">

        <div class="contop">
            <!-- 搜索框-->
            <div style="display: flex;width: 50%">
                <div style="width: 70%;"><input type="text" class=""
                                                style="border-radius: 10px; width: 100%;height: 30px; border: none; outline: none"
                                                placeholder="请输入商品名称查询"></div>
                <div style="width: 30%; padding-left: 10px;">
                    <button style="border-radius: 10px; background-color:red;font-size:14px;color:#fff;border: none;width: 100%;height: 30px;">
                        搜索商品
                    </button>
                </div>
            </div>
            <div>
                <img src="" alt="">
                <div>核销</div>
            </div>
        </div>
        <!--            <div class="add"></div>-->

        <div class="connr">
            <div class="connrl">
            </div>

            <div class="connrR">

                <!--                    <div class="nr">-->
                <!--                        <img src=" {$v1.image|htmlentities}" alt="" >-->
                <!--                        <div class="nrcon">-->
                <!--                            <div>12212</div>-->
                <!--                            <div style="margin-top: 6px;color: red">1245</div>-->
                <!--                        </div>-->
                <!--                    </div>-->
            </div>
        </div>
        <div>
            <div style="float: right;width: 30%">
                <button style="background: #ff9d9e;border: none;width: 40%;height: 30px;border-radius: 10px;">上一页
                </button>
                1/5
                <button style="background: #ff9d9e;border: none;width: 40%;height: 30px;border-radius: 10px;">下一页
                </button>
            </div>
        </div>

    </div>
    <div class="right" >
        <div class="top">
            <div class="topl">
                <div onclick="add_user()">新增客户</div>
                <div onclick="closethisorder()">关闭本单</div>
                <div>挂单本单</div>
            </div>
            <div class="topr">
                <div>挂单</div>
            </div>
        </div>
        <div class="con2 user_show_user">
            <div style="display: flex;align-items: center;justify-content: space-between">
                <div style="display: flex;align-items: center;">
                    <img style="width: 50px;height: 50px;border-radius: 50%;background: #FFF;margin-right: 15px;"
                         src="../../uploads/20241204/1c8cd8f2070ab5926ffef8020837cec5.jpg"
                         alt="">
                    <div>
                        <div style="display: flex;align-items: center;margin-bottom: 3px;">
                            <div style="font-size: 16px;" class="username">包子</div>
                            <svg t="1734406761782" class="icon" style="margin-left: 10px;" viewBox="0 0 1024 1024"
                                 version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6538" width="20" height="20">
                                <path d="M86.186667 432.576a21.290667 21.290667 0 0 1 2.538666-17.450667l166.805334-259.477333A106.666667 106.666667 0 0 1 345.258667 106.666667h333.482666a106.666667 106.666667 0 0 1 89.728 48.981333l166.826667 259.477333a21.333333 21.333333 0 0 1-2.56 26.325334L594.986667 864.597333a106.666667 106.666667 0 0 1-166.357334 0.469334L136.533333 503.253333l-45.589333-55.893333a21.248 21.248 0 0 1-4.778667-14.784z m804.885333-7.317333l-158.506667-246.528A64 64 0 0 0 678.762667 149.333333H345.258667a64 64 0 0 0-53.845334 29.397334L130.773333 428.650667l38.890667 47.701333 292.16 361.898667a64 64 0 0 0 99.84-0.277334l329.386667-412.714666z m-152.64-39.466667a21.333333 21.333333 0 0 1 33.706667 26.176L577.92 661.76a85.333333 85.333333 0 0 1-132.586667 2.645333l-204.373333-242.218666a21.333333 21.333333 0 1 1 32.597333-27.52l204.373334 242.218666a42.666667 42.666667 0 0 0 66.304-1.322666l194.197333-249.770667z"
                                      fill="#FF6700" p-id="6539"></path>
                            </svg>
                            <div style="font-size: 14px;margin-left: 3px;">钻石会员</div>
                        </div>
                        <div style="font-size: 14px;" class="mobile">18888569932</div>
                    </div>

                </div>
                <div onclick="userclean()">重新选择</div>
            </div>
        </div>
                <div class="con user_show">
                    <div style="display: flex;align-items: center;">
                        <svg t="1734404607680" class="icon" viewBox="0 0 1024 1024" version="1.1"
                             xmlns="http://www.w3.org/2000/svg" p-id="4282" width="20" height="20">
                            <path d="M514.972672 25.220096c-261.41696 0-473.339904 211.922944-473.339904 473.339904 0 261.424128 211.922944 473.344 473.339904 473.344 261.419008 0 473.34912-211.919872 473.34912-473.344C988.321792 237.14304 776.39168 25.220096 514.972672 25.220096zM810.990592 516.393984l-277.533696 0.64-0.584704 278.121472c-0.039936 10.202112-8.31488 18.477056-18.516992 18.477056l-0.039936 0c-10.202112-0.039936-18.477056-8.31488-18.477056-18.556928l0.582656-277.955584-277.376 0.64-0.039936 0c-10.202112 0-18.477056-8.274944-18.516992-18.477056 0-10.202112 8.233984-18.516992 18.477056-18.556928l277.533696-0.64 0.584704-278.121472c0.039936-10.202112 8.31488-18.477056 18.516992-18.477056l0.039936 0c10.202112 0.039936 18.477056 8.31488 18.477056 18.556928L533.53472 480l277.376-0.64 0.039936 0c10.202112 0 18.477056 8.274944 18.516992 18.477056C829.467648 508.039168 821.233664 516.353024 810.990592 516.393984z"
                                  fill="#d81e06" p-id="4283"></path>
                        </svg>
                        <!--                <img src="" alt="">-->
                        <div class="connr" style="color: red;height: 50px;line-height: 50px;" onclick="choose_user()">
                            点击选择客户
                        </div>
                    </div>
                </div>
        <div class="top" style="margin-top: 14px">
            <div>商品数量</div>
            <div style="color: red" onclick="goodsclean()">清空</div>
        </div>
        <div class="scrollable-div" style="width: 100%; height: 500px;" id="goodList">
            <!-- 滚动内容 -->

        </div>
        <div class="scrollable-div" style="width: 100%; height: 500px;" id="cardList">
            <!-- 滚动内容 -->

        </div>
        <div class="btn">
            <div class="btndf">
                <div id="totalh">代收款 <span id="total" style="color: red"></span></div>
                <div id="cardtotalh">代收款 <span id="cardtotal" style="color: red"></span></div>
                <div>会员价</div>
            </div>
            <div class="btndf">
                <div class="anniu1">改价</div>
                <div class="anniu2" onclick="create_order()">收款</div>
            </div>

        </div>

    </div>
    <!--         会员信息-->
    <div style="width: 92%;" id="cashier">
        <div style="margin-top: 1%;margin-bottom: 1%;display: flex;align-items: center;margin-left: 2.6%;">
            <img src="" alt="">
            <div style="font-weight: bold;font-size: 22px" onclick="back()">返回开单</div>
        </div>
        <div style="display: flex;align-items: center;justify-content: center;width: 100%;">


            <div style="width: 32%;height: 80vh;background-color: #FFFFFF;border-radius: 10px;padding: 20px 30px;">
                <div style="display: flex;">
                    <img src="" alt="">
                    <div>会员信息</div>
                </div>
                <div style="padding:16px;padding-top: 0">
                    <div style="background:url('../../uploads/20241222143858.png');background-size: cover;background-position: center center;background-repeat: no-repeat;width: auto;border-radius: 6px;padding: 3%;">

                        <div style="display: flex;margin-top: 7%">
                            <img src="" alt="">
                            <div>砖石会员</div>
                        </div>


                        <div style="display: flex;align-items: center;margin-top: 2%">
                            <img src="" alt=""
                                 style="width: 50px;height: 50px;margin-right: 15px;border-radius:50%;background: #000;">
                            <div>
                                <div class="username">包子</div>
                                <div style="margin-top: 6px" class="mobile">188888</div>

                                <div style="display: flex;margin-top: 20px">
                                    <div class="money">余额：18888</div>
                                    <div style="margin-left: 20px" class="score">积分：18888</div>
                                </div>
                            </div>
                        </div>

                    </div>

                    <div style="display: flex;margin-top: 7%;padding: 3%; box-shadow: 0px 0px 8px 1px rgba(0, 0, 0, 0.1);justify-content: space-between;border-radius: 6px;">

                        <div>选择销售人员</div>
                        <div style="display: flex;align-items: center;">
                            <div>选择</div>
                            <img src="" alt="">
                        </div>
                    </div>

                </div>


                <div style="margin-top: 4%">优惠券</div>
                <div style="padding:16px;padding-top: 3%;display: flex;align-items: center;flex-wrap: wrap;justify-content: space-between" id="coupon">

                    <div style="width: 38%;display: flex;padding:6% 5%; justify-content: space-between;border-radius: 6px;border: 1px solid red;color: red;background: #fff1eb;margin-top: 2%">
                        <div style="display: flex;align-items: center;">
                            <img src="" alt="">
                            <div>5元优惠券</div>
                        </div>
                        <div>可用</div>

                    </div>

                    <div style="width: 38%;display: flex;padding:6% 5%; justify-content: space-between;border-radius: 6px;border: 1px solid #dfdfdf;color: #AAAAAA;background: #dfdfdf;margin-top: 2%">
                        <div style="display: flex;align-items: center;">
                            <img src="" alt="">
                            <div>5元优惠券</div>

                        </div>
                        <div>不可用</div>
                    </div>

                </div>


                <div style="margin-top: 4%">卡项</div>
                <div id="checkcard"></div>

            </div>
            <div style="width: 32%;height: 80vh;background-color: #FFFFFF;border-radius: 10px;margin-left: 1.2%;padding: 20px 30px;">
                <div style="display: flex;">
                    <img src="" alt="">
                    <div>费用明细</div>
                </div>


                <div style="padding:16px;padding-top: 0">

                    <div style="margin-top: 2%;padding: 3%;padding-bottom:8%;font-weight: bold;border-bottom: 1px solid #cccccc;">
                        <div style="display: flex;align-items: center;justify-content: space-between;margin-top: 5%">
                            <div>费用合计</div>
                            <div id="totalzongji"> </div>
                        </div>
                        <div style="display: flex;align-items: center;justify-content: space-between;margin-top: 5%">
                            <div>议价金额</div>
                            <div id="yijiazongji"> </div>
                        </div>

                        <div style="display: flex;align-items: center;justify-content: space-between;margin-top: 5%">
                            <div>会员折扣</div>
                            <div id="vip_total"> </div>
                        </div>

                        <div style="display: flex;align-items: center;justify-content: space-between;margin-top: 5%">
                            <div>优惠券</div>
                            <div id="coupon_total"> ¥ 0.00 </div>
                        </div>
                        <div style="display: flex;align-items: center;justify-content: space-between;margin-top: 5%">
                            <div>权益卡折扣</div>
                            <div id="card_price_use">¥ 0.00</div>
                        </div>

                    </div>

                </div>

                <div style="padding:16px;padding-top: 0;padding-bottom:8%;height: 20vh;display: flex;align-items: flex-end;justify-content: flex-end;border-bottom: 1px solid #cccccc;">
                    <div>代收金额 <span style="font-weight: bold;font-size: 22px;color: red;" id="paytotal"></span></div>
                </div>


                <div style="margin-top: 8%">
                    <div>支付方式</div>



                    <div style="margin-top: 2%;display: flex;padding:16px;align-items: center;justify-content: space-between">
                        <!--                    未选中-->



                        <div>
                            <div style="width: 80px;height: 80px;border-radius: 25%;background: #e5e5e5;align-items: center;justify-content: center;border: 2px solid #e5e5e5;align-items: center;display: flex;">
                                    <svg t="1735573488759" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1610" width="40" height="40">
                                        <path d="M647.09 343.12L555.22 452.8h70.31c15.53 0 28.12 12.59 28.12 28.12 0 15.53-12.59 28.12-28.12 28.12h-84.37v43.87h84.37c15.53 0 28.12 12.59 28.12 28.12 0 15.53-12.59 28.12-28.12 28.12h-84.37v96.18c0 15.53-12.59 28.12-28.12 28.12-15.53 0-28.12-12.59-28.12-28.12v-96.18h-84.37c-15.53 0-28.12-12.59-28.12-28.12 0-15.53 12.59-28.12 28.12-28.12h84.37v-43.87h-84.37c-15.53 0-28.12-12.59-28.12-28.12 0-15.53 12.59-28.12 28.12-28.12h70.31l-91.87-109.68c-9.99-11.91-8.44-29.66 3.47-39.65 11.91-9.99 29.66-8.44 39.65 3.47l90.93 108.55 90.93-108.55c9.99-11.91 27.75-13.46 39.65-3.47 11.91 9.99 13.46 27.74 3.47 39.65zM926.84 512c0 40.8 31.7 76.8 75.61 79.2 12.19 0 21.95 12 21.95 24V872c0 14.4-9.76 24-24.39 24H24.39C9.76 896 0 886.4 0 872V615.2c0-12 9.76-24 21.95-24 41.47-2.4 75.61-38.4 75.61-79.2 0-40.8-31.71-76.8-75.61-79.2-12.19 0-21.95-12-21.95-24V152c0-14.4 9.76-24 24.39-24h975.62c14.63 0 24.39 9.6 24.39 24v256.8c0 12-9.76 24-21.95 24-43.91 2.4-75.61 38.4-75.61 79.2zM851.4 512c0-54.11 23-112 101-132V207H72.4v169c78 22 94.95 79.89 94.95 134S142.4 630 72.4 653v160h880V647c-78-26-101-80.89-101-135z" p-id="1611" fill="#d81e06"></path>
                                    </svg>
                            </div>
                            <div style="text-align: center;margin-top:16%;font-weight: bold">现金</div>
                        </div>


                        <!--                     选中-->
                        <div>
                            <div style="width: 80px;height: 80px;border-radius: 25%;background: #ffffff;align-items: center;justify-content: center;border: 2px solid red;align-items: center;display: flex;">
                                <svg t="1735575436283" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3687" width="40" height="40"><path d="M512 53.44C246.912 53.44 32 267.264 32 531.072s214.912 477.696 480 477.696c265.088 0 480-213.888 480-477.696S777.088 53.44 512 53.44z m0 895.744a418.048 418.048 0 1 1 0-836.16 418.048 418.048 0 0 1 0 836.16z m175.168-686.912a31.04 31.04 0 0 0-43.84 0L511.424 394.176 380.672 263.424a31.04 31.04 0 0 0-43.84 0 31.04 31.04 0 0 0 0 43.776l116.608 116.544H372.672a31.04 31.04 0 0 0-30.976 30.976c0 17.024 13.888 30.976 30.976 30.976h108.352v70.272H372.672a31.04 31.04 0 0 0-30.976 30.976c0 17.024 13.888 30.912 30.976 30.912h108.352v160.128c0 17.024 13.952 30.976 30.976 30.976a31.04 31.04 0 0 0 30.976-30.976V617.856h108.352a31.04 31.04 0 0 0 30.976-30.912 31.04 31.04 0 0 0-30.976-30.976H542.976V485.696h108.352a31.04 31.04 0 0 0 30.976-30.976 31.04 31.04 0 0 0-30.976-30.976h-81.92l117.76-117.696a31.04 31.04 0 0 0 0-43.776z" fill="#d81e06" fill-opacity=".65" p-id="3688"></path></svg>
                            </div>
                            <div style="text-align: center;margin-top:16%;font-weight: bold">余额</div>
                        </div>
                        <div>
                            <div style="width: 80px;height: 80px;border-radius: 25%;background: #e5e5e5;align-items: center;justify-content: center;border: 2px solid #e5e5e5;align-items: center;display: flex;">
                                <svg t="1735575514918" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4773" width="40" height="40"><path d="M230.404 576.536c-12.087 9.728-25.043 23.93-28.805 41.984-5.12 24.666-1.069 55.541 22.728 79.761 28.828 29.362 72.637 37.398 91.56 38.779 51.4 3.717 106.184-21.772 147.477-50.844 16.184-11.42 43.899-34.349 70.39-69.721-59.37-30.653-133.477-64.557-212.703-61.24-40.47 1.692-69.454 10.084-90.647 21.281z m752.859 135.545C1009.463 650.574 1024 582.968 1024 512 1024 229.688 794.335 0 512 0 229.665 0 0 229.688 0 512c0 282.335 229.665 512 512 512 170.385 0 321.491-83.723 414.631-212.124-87.997-43.742-233.027-115.734-322.36-159.299-42.63 48.596-105.65 97.303-176.84 118.495-44.722 13.29-85.037 18.365-127.199 9.75-41.739-8.548-72.481-28.093-90.401-47.683-9.127-9.995-19.612-22.706-27.203-37.82a71.25 71.25 0 0 0 1.202 3.049s-4.363-7.524-7.702-19.5a85.994 85.994 0 0 1-3.34-18.143 93.517 93.517 0 0 1-0.2-13.045c-0.378-7.702-0.066-15.783 1.67-24.064 4.185-20.235 12.822-43.81 35.172-65.692 49.063-48.039 114.777-50.621 148.814-50.42 50.421 0.289 138.04 22.35 211.812 48.439 20.436-43.52 33.547-90.068 42.007-121.1H305.308v-33.168h157.518v-66.337H272.139v-33.169h190.687v-66.315c0-9.105 1.803-16.584 16.584-16.584h74.619v82.899h207.293v33.169H554.029v66.337h165.82s-16.65 92.828-68.719 184.32c115.557 41.272 278.128 104.849 332.133 126.086z" fill="#1296DB" p-id="4774"></path></svg>
                            </div>
                            <div style="text-align: center;margin-top:16%;font-weight: bold">支付宝</div>
                        </div>
                        <div>
                            <div style="width: 80px;height: 80px;border-radius: 25%;background: #e5e5e5;align-items: center;justify-content: center;border: 2px solid #e5e5e5;align-items: center;display: flex;">
                                <svg t="1735575555926" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5829" width="40" height="40"><path d="M711.9744 335.6032c5.19424 0 10.28992 0.09728 15.38816 0.34176C700.40704 189.1712 548.79616 76.8 365.80608 76.8 163.75552 76.8 0 213.7728 0 382.74688 0 481.8112 56.28416 569.90208 143.58656 625.792c1.12896 0.7104 3.35744 2.10816 3.35744 2.10816l-35.35616 110.73024 132.2432-67.36c0 0 4.13952 1.19936 6.22208 1.78944 36.36224 10.11968 75.29856 15.6096 115.75296 15.6096 8.25728 0 16.4416-0.31872 24.57728-0.76032-7.49696-23.25504-11.61472-47.73376-11.61472-72.99584C378.76864 460.66432 527.9936 335.6032 711.9744 335.6032zM493.09952 227.64032c28.37504 0 51.3344 22.24896 51.3344 49.74336 0 27.44192-22.95808 49.7408-51.3344 49.7408-28.39808 0-51.35616-22.29888-51.35616-49.7408C441.74208 249.88928 464.70144 227.64032 493.09952 227.64032zM238.51136 327.12448c-28.37248 0-51.35616-22.29888-51.35616-49.7408 0-27.4944 22.98368-49.74336 51.35616-49.74336 28.40064 0 51.40992 22.24896 51.40992 49.74336C289.92128 304.8256 266.912 327.12448 238.51136 327.12448z" fill="#1afa29" p-id="5830"></path><path d="M405.67424 616.72704c0 142.75328 138.39232 258.48192 309.09312 258.48192 34.1568 0 67.04128-4.65408 97.76768-13.23008 1.76384-0.4672 5.24416-1.52064 5.24416-1.52064l111.68384 56.9472-29.8432-93.5552c0 0 1.91232-1.19936 2.84288-1.78688 73.70496-47.2192 121.29024-121.60896 121.29024-205.33632 0-142.73152-138.34496-258.43456-308.9856-258.43456C544.06656 358.29248 405.67424 473.99552 405.67424 616.72704zM778.8672 527.7056c0-23.17952 19.40608-41.97248 43.37024-41.97248 24.0128 0 43.42016 18.79296 43.42016 41.97248 0 23.22944-19.40864 42.048-43.42016 42.048C798.27328 569.7536 778.8672 550.93504 778.8672 527.7056zM563.79136 527.7056c0-23.17952 19.4304-41.97248 43.39456-41.97248 23.98976 0 43.42016 18.79296 43.42016 41.97248 0 23.22944-19.4304 42.048-43.42016 42.048C583.22176 569.7536 563.79136 550.93504 563.79136 527.7056z" fill="#1afa29" p-id="5831"></path></svg>
                            </div>
                            <div style="text-align: center;margin-top:16%;font-weight: bold">微信</div>
                        </div>
                        <div>
                            <div style="width: 80px;height: 80px;border-radius: 25%;background: #e5e5e5;align-items: center;justify-content: center;border: 2px solid #e5e5e5;align-items: center;display: flex;">
                                <svg t="1735575589073" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6933" width="40" height="40"><path d="M874.666667 394.666667H149.333333v373.333333a53.333333 53.333333 0 0 0 53.333334 53.333333h618.666666a53.333333 53.333333 0 0 0 53.333334-53.333333V394.666667z m-725.333334-64h725.333334v-74.666667a53.333333 53.333333 0 0 0-53.333334-53.333333H202.666667a53.333333 53.333333 0 0 0-53.333334 53.333333v74.666667z m608 341.333333a32 32 0 0 1 0 64H650.666667a32 32 0 0 1 0-64h106.666666zM202.666667 138.666667h618.666666c64.8 0 117.333333 52.533333 117.333334 117.333333v512c0 64.8-52.533333 117.333333-117.333334 117.333333H202.666667c-64.8 0-117.333333-52.533333-117.333334-117.333333V256c0-64.8 52.533333-117.333333 117.333334-117.333333z" fill="#d81e06" p-id="6934"></path></svg>
                            </div>
                            <div style="text-align: center;margin-top:16%;font-weight: bold">银行卡</div>
                        </div>
                    </div>


                </div>


                <div style="margin-top: 2%;padding:16px;">

                    <div style="width: auto;padding: 22px;text-align: center;background: red;color: #FFFFFF;border-radius: 10px;" onclick="payorder()">
                        结帐
                    </div>
                </div>


            </div>
            <div style="width: 20%;height: 80vh;background-color: #FFFFFF;border-radius: 10px;margin-left: 1.2%;padding: 20px 30px;">
                <div style="font-size: 18px;text-align: center;font-weight: bold">微信</div>
                <div style="color: red;font-weight: bolderl;font-size: 20px;text-align: center;margin-top: 13%;margin-bottom: 20%;">
                    ¥<span style="font-size: 52px" id="pay"></span></div>
                <div style="display: flex;justify-content: center;align-items: center;margin-bottom: 10%;">
                    <img src="" alt="" style="width: 300px;height: 300px;background: #000;">
                </div>
                <div style="text-align: center">客户手机扫此收款码</div>



            </div>
        </div>

    </div>


</div>
</body>

<style>
    * {
        margin: 0;
        padding: 0;
    }

    body {

        background: #F5F5F5;
    }

    .content {
        width: 100%;
        /*margin: auto;*/
        display: flex;
        /*margin-top: 22px;*/
        height: 100vh;

        .left {
            width: 8%;
            padding: 15px;
            display: flex;
            align-items: center;
            flex-direction: column;
            background: #ffffff;

            .leftbtn {
                width: 80px;
                height: 80px;
                border-radius: 10px;
                display: flex;
                align-items: center;
                justify-content: center;
                flex-direction: column;
                color: #ccc;
                font-size: 14px;
                margin-top: 10px;

                img {
                    width: 22px;
                    height: 22px;
                    margin-bottom: 10px;
                }
            }

            .leftbtn2 {
                width: 80px;
                height: 80px;
                border-radius: 10px;
                display: flex;
                align-items: center;
                justify-content: center;
                flex-direction: column;
                color: #fff;
                background: red;
                font-size: 14px;
                margin-top: 10px;

                img {
                    width: 22px;
                    height: 22px;
                    margin-bottom: 10px;
                }
            }

        }

        .active {
            border-radius: 15px;
            border: 1px solid red;
            background-color: red;

            .icon path {
                fill: #fff;
            }

            color: #FFFFFF;

        }

        .con {
            width: 62%;
            padding: 15px;
            background-color: #f9f9f9;

            .contop {

                display: flex;
                align-items: center;
                justify-content: space-between;
            }

            .connr {
                display: flex;
                align-items: flex-start;
                font-size: 14px;
                height: 83vh;

                .connrl {
                    width: 16%;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    flex-direction: column;
                    margin-top: 22px;

                    .connrlbtn2 {
                        width: 92px;
                        height: 25px;
                        border-radius: 15px;
                        border: 1px solid red;
                        text-align: center;
                        line-height: 25px;
                        color: red;
                        background-color: #ff9d9e;
                        margin-top: 10px;
                    }

                    .connrlbtn {
                        width: 94px;
                        height: 27px;
                        text-align: center;
                        line-height: 27px;
                        margin-top: 10px;
                        border: none;
                    }
                }

                .active {
                    border-radius: 15px;
                    border: 1px solid red;
                    background-color: #ff9d9e;
                }

                .connrR {
                    width: 84%;
                    display: flex;
                    flex-wrap: wrap;
                    align-items: center;

                    .nr {

                        width: 32%;
                        margin-right: 2%;
                        margin-top: 22px;
                        background-color: #FFFFFF;
                        border-radius: 10px;
                        padding-top: 20px;
                        padding-bottom: 20px;
                        display: flex;
                        /*padding-left: 20px;*/
                        /*justify-content: center;*/

                        img {
                            width: 50px;
                            height: 50px;
                            margin-left: 10px;
                            border-radius: 50%;
                            background-color: #fff2c5;
                        }

                        .nrcon {
                            margin-left: 10px;
                        }
                    }

                    .nr:nth-child(3n) {
                        margin-right: 0;
                    }
                }
            }

        }

        .right {
            width: 30%;
            background-color: #FFFFFF;
            padding: 15px;
            position: relative;

            .top {
                display: flex;
                align-items: center;
                justify-content: space-between;
                font-size: 12px;
                padding-bottom: 20px;

                .topl {
                    display: flex;
                    align-items: center;

                    div {

                        width: 60px;
                        height: 25px;
                        text-align: center;
                        line-height: 25px;
                        border: 1px solid #ccc;
                        border-radius: 6px;
                        color: red;
                        margin-right: 12px;
                    }
                }

                .topr {
                    div {

                        width: 60px;
                        height: 25px;
                        text-align: center;
                        line-height: 25px;
                        border: 1px solid #ccc;
                        border-radius: 6px;
                        color: red;
                    }
                }
            }

            .con {
                display: flex;
                align-items: center;
                justify-content: center;
                color: red;
                background-color: #ff9d9e;
                font-size: 14px;
                width: auto;
                height: 50px;
                margin-top: 12px;
                border-radius: 6px;

                img {
                    width: 18px;
                    height: 18px;
                    margin-right: 6px;
                }
            }

            .con2 {
                background-color: #FFEEF1;
                font-size: 14px;
                width: auto;
                height: 50px;
                margin-top: 12px;
                border-radius: 6px;
                padding: 15px;
            }

            .btn {
                font-size: 14px;
                position: absolute;
                bottom: 0;
                left: 0;
                width: 100%;

                .btndf {
                    padding: 15px;
                    padding-top: 10px;
                    display: flex;
                    align-items: center;
                    justify-content: space-between;

                    .anniu1 {
                        width: 48%;
                        height: 40px;
                        text-align: center;
                        line-height: 40px;
                        background-color: deepskyblue;
                        color: #FFFFFF;
                        border-radius: 10px;
                    }

                    .anniu2 {
                        width: 48%;
                        height: 40px;
                        text-align: center;
                        line-height: 40px;
                        background-color: red;
                        color: #FFFFFF;
                        border-radius: 10px;
                    }
                }
            }
        }
    }

    .scrollable-div {
        overflow: auto; /* 使div可滚动 */
        scrollbar-width: none; /* 对于现代浏览器隐藏滚动条 */
    }

    /* 兼容IE和Edge */
    .scrollable-div::-webkit-scrollbar {
        display: none;
    }

    .scrollable-div {
        -ms-overflow-style: none; /* IE 10+ */
    }

    .product-card {
        display: flex;
        align-items: center;
        padding: 10px;
        font-family: Arial, sans-serif;
    }

    .product-image {
        width: 80px;
        height: 80px;
        border-radius: 5px;
        margin-right: 20px;
    }

    .product-details {
        flex-grow: 1;
    }

    .product-name {
        font-size: 16px;
        color: #333;
        margin: 0 0 5px;
    }

    .product-price {
        color: #e60012;
        font-size: 18px;
        margin: 0 0 10px;
    }

    .product-specs {
        color: #666;
        font-size: 14px;
        margin: 0 0 10px;
    }

    .quantity-control {
        display: flex;
        align-items: center;
    }

    .quantity-control button {
        background-color: #e60012;
        color: white;
        border: none;
        padding: 5px 10px;
        border-radius: 5px;
        cursor: pointer;
    }

    .quantity-control button:disabled {
        background-color: #ccc;
    }

    .quantity-control input {
        width: 30px;
        text-align: center;
        margin: 0 5px;
        border: 1px solid #e0e0e0;
        border-radius: 5px;
        padding: 5px;
    }
     .active-coupon{
        border: 1px solid red;
         border-radius: 6px;
    }
     .coupon—list{
         width: 38%;display: flex;padding:6% 5%; justify-content: space-between;border-radius: 6px;color: #AAAAAA;background: #dfdfdf;margin-top: 2%
     }
     .coupon-list-set{
         width: 38%;
         display: flex;
         padding:6% 5%;
         justify-content: space-between;
         border-radius: 6px;
         color: red;
         background: #fff1eb;
         margin-top: 2%
     }
</style>


</html>
<script>
    $(document).ready(function () {
        var type = 'good';
        var total = 0;
        var cardtotal = 0;
        $("#goodList").show();
        $("#totalh").show();
        $("#cardList").hide();
        $("#cardtotalh").hide();
        $("#cashier").hide();
        var goodHtml = '';
        var cardHtml = '';
        var username =   sessionStorage.getItem('username');
        username = JSON.parse(username);
        if (username == null){
           $('.user_show').show()
            $('.user_show_user').hide()
        }else{
            $('.user_show_user').show()
            $('.user_show').hide()
            setuser();
        }
        $.ajax({
            type: 'post',
            url: 'index',
            data: {type: type},
            dataType: 'json',
            success: function (data) {
                if (data.code == 1) {
                    var cateHtml = '';
                    for (var i = 0; i < data.data.category.length; i++) {
                        if (i == 0) {
                            cateHtml +=
                                '<div class="connrlbtn my-button  active" data-id="' + data.data.category[i].id + '" data-type="' + type + '">' + data.data.category[i].name + '</div>\n';
                        } else {
                            cateHtml +=
                                '<div class="connrlbtn my-button " data-id="' + data.data.category[i].id + '" data-type="' + type + '">' + data.data.category[i].name + '</div>\n';
                        }
                    }
                    $('.connrl').html(cateHtml);
                    var html = '';
                    for (var j = 0; j < data.data.list.data.length; j++) {
                        html +=
                            '                    <div class="nr" data-id="' + data.data.list.data[j].id + '">\n' +
                            '                        <img src="' + data.data.list.data[j].image + '" alt="" >\n' +
                            '                        <div class="nrcon">\n' +
                            '                            <div>' + data.data.list.data[j].title + '</div>\n' +
                            '                            <div style="margin-top: 6px;color: red">' + data.data.list.data[j].price + '</div>\n' +
                            '                        </div>\n' +
                            '                    </div>\n' +
                            '                ';
                    }
                    // console.log(data)
                }
                $('.connrR').html(html);
            }
        })
        var data = sessionStorage.getItem('myArray');
        if (data == null || data  == '') {
            data = [];
        } else {
            data = JSON.parse(data);

            for (var j = 0; j < data.length; j++) {
                if (data[j].type == 'good') {
                    goodHtml += '<div style=" border: 1px solid #e0e0e0; border-radius: 5px;"><div class="product-card">\n' +
                        '                    <img src="' + data[j].image + '"  class="product-image">\n' +
                        '                    <div class="product-details">\n' +
                        '                        <p class="product-name">' + data[j].goods_title + '</p>\n' +
                        '                        <p class="product-price">' + data[j].price + '</p>\n' +
                        '                        <p class="product-specs">规格：' + data[j].title + '</p>\n' +
                        '                        <div class="quantity-control">\n' +
                        '                            <button id="min_' + j + '" onclick="mina(' + j + ')">-</button>\n' +
                        '                            <input type="text" id="text_box_' + j + '"  value="' + data[j].num + '" readonly>\n' +
                        '                            <button onclick="add(' + j + ')">+</button>\n' +
                        '                        </div></div>' +
                        '<a onclick="save_good_price(' + j + ')" herf="#" style="font-size: 12px;">改价</a>' +
                        '<a style="font-size: 12px;padding-left: 10px;" herf="#" onclick="del_good(' + j + ')">删除</a>' +
                        '</div>' +
                        '<div style="display: flex;font-size:10px;padding: 10px 0;margin:0 10px;justify-content: space-between;align-items: center;border-top:1px solid #AAAAAA ;">' +
                        '<div style="display: flex;align-items: center" onclick="choose_staff(' + j + ')"><img style="width: 30px;height: 30px;border-radius: 50%;background: #000;" src="../../uploads/20241204/1c8cd8f2070ab5926ffef8020837cec5.jpg" alt=""><div style="margin-left: 10px;" > 包子（美容师）</div>' +
                        '<svg t="1734418429727" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7786" width="10" height="10"><path d="M693.333333 512c0 14.933333-4.266667 29.866667-14.933333 40.533333l-234.666667 277.333334c-23.466667 27.733333-64 29.866667-89.6 8.533333-27.733333-23.466667-29.866667-64-8.533333-89.6L546.133333 512l-200.533333-236.8c-23.466667-27.733333-19.2-68.266667 8.533333-89.6 27.733333-23.466667 68.266667-19.2 89.6 8.533333l234.666667 277.333334c10.666667 10.666667 14.933333 25.6 14.933333 40.533333z" fill="#bfbfbf" p-id="7787"></path></svg>' +
                        '</div>' +
                        '<div style="display: flex;align-items: center"  onclick="choose_card(' + j + ',' + data[j].sku_id + ')"><div>选择权益卡</div><svg t="1734418625535" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10544" width="10" height="10"><path d="M573.056 752l308.8-404.608A76.8 76.8 0 0 0 820.736 224H203.232a76.8 76.8 0 0 0-61.056 123.392L450.976 752a76.8 76.8 0 0 0 122.08 0z" p-id="10545" fill="#bfbfbf"></path></svg></div></div>' +
                        '</div>';
                }


                total += data[j].num * data[j].price;
            }

            var carddata = sessionStorage.getItem('cardArray');
            if (carddata == null || carddata  == '') {
                carddata = [];
            } else {
                data = JSON.parse(carddata);
                for (var j = 0; j < data.length; j++) {
                    if (data[j].type == 'card') {
                        // 卡项
                        cardHtml += '<div style="border-radius: 10px;border: 1px solid red;margin-top: 10px;">\n' +
                            '                    <div style="display: flex;justify-content: space-between;align-items: center;padding: 15px;padding-bottom: 10px;font-size: 14px;">\n' +
                            '                        <div>\n' +
                            '                            <div >' + data[j].title + '</div>\n' +
                            '                            <div >' + data[j].service + '</div>\n' +
                            '                        </div>\n' +
                            '                        <div>¥ ' + data[j].price + '</div>\n' +
                            '                    </div>\n' +
                            '                    <div style="display: flex;justify-content: space-between;align-items: center;padding: 15px;padding-top: 0px;padding-bottom: 20px;font-size: 14px;">\n' +
                            '\n' +
                            '                        <div>' + data[j].time + ' </div>\n' +
                            '                        <div>' + data[j].total + '</div>\n' +
                            '                    </div>\n' +
                            '                    <div style="font-size: 14px;display: flex;justify-content: space-between;align-items: center;padding: 10px 15px;background: red;color: #FFF;border-radius: 0 0 10px 10px;">\n' +
                            '                        <div>' + data[j].type_name + '</div>\n' +
                            '                        <div> <input id="min_card_' + data[j].id + '" name="" type="button" value="-" onclick="mina_card_list(' + data[j].id + ')"  style="width: 35px;height: 35px;border-radius: 50%;border: none;font-size: 25px;color: red"/>\n' +
                            '                    <input id="text_card_list_' + data[j].id + '" name="card[' + data[j].id + '][num]" type="text" value="' + data[j].num + '"  style="width: 35px;outline:none;height: 35px;border: none;font-size: 25px;text-align: center" readonly/>\n' +
                            '                    <input id="add_card_' + data[j].id + '" name="" type="button" value="+" onclick="add_card_list(' + data[j].id + ')" style="width: 35px;height: 35px;border-radius: 50%;border: none;font-size: 25px;color: red"/></div>\n' +
                            '                    </div>\n' +
                            '                </div>';
                    }

                    cardtotal += data[j].num * data[j].price;
                }
            }
            $('#goodList').html(goodHtml);
            $('#cardList').html(cardHtml);
            total = formatNumber(total);
            cardtotal = formatNumber(cardtotal);
            $('#total').html(total);
            $('#cardtotal').html(cardtotal);
        }


    })
    $(document).on('click', '.sell', function () {
        $(this).addClass('active').siblings().removeClass('active');
        var type = $(this).data('type');
        if (type == 'card') {
            $('#cardList').show();
            $('#goodList').hide();
            $('#totalh').hide();
            $('#cardtotalh').show();
        } else {
            $('#goodList').show();
            $('#cardList').hide();
            $('#totalh').show();
            $('#cardtotalh').hide();
        }
        $.ajax({
            type: 'post',
            url: 'index',
            data: {type: type},
            dataType: 'json',
            success: function (data) {
                if (data.code == 1) {
                    var cateHtml = '';
                    for (var i = 0; i < data.data.category.length; i++) {
                        if (i == 0) {
                            cateHtml +=
                                '<div class="connrlbtn my-button  active" data-id="' + data.data.category[i].id + '" data-type="' + type + '">' + data.data.category[i].name + '</div>\n';
                        } else {
                            cateHtml +=
                                '<div class="connrlbtn my-button" data-id="' + data.data.category[i].id + '" data-type="' + type + '">' + data.data.category[i].name + '</div>\n';
                        }
                    }
                    $('.connrl').html(cateHtml);
                    var html = '';
                    if (type !== 'card') {
                        for (var j = 0; j < data.data.list.data.length; j++) {
                            html +=
                                '                    <div class="nr" data-id="' + data.data.list.data[j].id + '">\n' +
                                '                        <img src="' + data.data.list.data[j].image + '" alt="" >\n' +
                                '                        <div class="nrcon">\n' +
                                '                            <div>' + data.data.list.data[j].title + '</div>\n' +
                                '                            <div style="margin-top: 6px;color: red">' + data.data.list.data[j].price + '</div>\n' +
                                '                        </div>\n' +
                                '                    </div>\n' +
                                '                ';
                        }
                    } else {
                        html = '<div style="display: flex;flex-wrap: wrap;width: 100%;justify-content: space-between;">';
                        for (var j = 0; j < data.data.list.data.length; j++) {
                            html +=
                                '                    <div style="width: 45%;border-radius: 10px;border: 1px solid red;margin-top: 10px;">\n' +
                                '                        <div style="display: flex;justify-content: space-between;align-items: center;padding: 15px;padding-bottom: 10px;">\n' +
                                '                            <div>\n' +
                                '                                <div id="card_' + data.data.list.data[j].id + '">' + data.data.list.data[j].name + '</div>\n' +
                                '                                <div id="card_service_' + data.data.list.data[j].id + '">项目：' + data.data.list.data[j].card_service + '</div>\n' +
                                '                            </div>\n' +
                                '\n' +
                                '\n' +
                                '                            <div id="card_price_' + data.data.list.data[j].id + '">' + data.data.list.data[j].price + '</div>\n' +
                                '                        </div>\n' +
                                '                        <div style="display: flex;justify-content: space-between;align-items: center;padding: 15px;padding-top: 0px;padding-bottom: 20px;">\n' +
                                '\n' +
                                '                                <div id="card_time_' + data.data.list.data[j].id + '">有效期：' + data.data.list.data[j].time + '</div>\n' +
                                '                            <div id="card_total_' + data.data.list.data[j].id + '">' + data.data.list.data[j].total + ' 次</div>\n' +
                                '                        </div>\n' +
                                '\n' +
                                '                        <div style="display: flex;justify-content: space-between;align-items: center;padding: 10px 15px;background: red;color: #FFF;border-radius: 0 0 10px 10px;">\n' +
                                '                            <div id="card_type_name_' + data.data.list.data[j].id + '">' + data.data.list.data[j].type_name + '</div>\n' +
                                '                            <div>' +
                                '<input id="min_' + data.data.list.data[j].id + '" name="" type="button" value="-" onclick="mina_card(' + data.data.list.data[j].id + ')"  style="width: 35px;height: 35px;border-radius: 50%;border: none;font-size: 25px;color: red"/>\n' +
                                '                    <input id="text_box_card_' + data.data.list.data[j].id + '" name="sku[' + data.data.list.data[j].id + '][num]" class="text_box_' + data.data.list.data[j].id + '" type="text" value="0"  style="width: 35px;outline:none;height: 35px;border: none;font-size: 25px;text-align: center" readonly/>\n' +
                                '                    <input id="add_' + data.data.list.data[j].id + '" name="" type="button" value="+" onclick="add_card(' + data.data.list.data[j].id + ')" style="width: 35px;height: 35px;border-radius: 50%;border: none;font-size: 25px;color: red"/>' +
                                '</div>' +
                                '</div>\n' +
                                '                        </div>\n';
                        }
                        html += '</div>';
                    }

                    // console.log(data)
                }
                $('.connrR').html(html);
            }
        })

    })
    $(document).on('click', '.my-button', function () {
        $(this).siblings().removeClass('active');
        $(this).addClass('active');

        var id = $(this).data('id');
        var type = $(this).data('type');
        $.ajax({
            type: 'post',
            url: 'index',
            data: {type: type, id: id},
            dataType: 'json',
            success: function (data) {
                if (data.code == 1) {
                    var html = '';
                    if (type == 'card') {
                        var html = '<div style="display: flex;flex-wrap: wrap;width: 100%;justify-content: space-between;">\n';
                        for (var j = 0; j < data.data.list.data.length; j++) {
                            html +=
                                '                    <div style="width: 45%;border-radius: 10px;border: 1px solid red;margin-top: 10px;">\n' +
                                '                        <div style="display: flex;justify-content: space-between;align-items: center;padding: 15px;padding-bottom: 10px;">\n' +
                                '                            <div>\n' +
                                '                                <div id="card_' + data.data.list.data[j].id + '">' + data.data.list.data[j].name + '</div>\n' +
                                '                                <div id="card_service_' + data.data.list.data[j].id + '">项目：' + data.data.list.data[j].card_service + '</div>\n' +
                                '                            </div>\n' +
                                '\n' +
                                '\n' +
                                '                            <div id="card_price_' + data.data.list.data[j].id + '">' + data.data.list.data[j].price + '</div>\n' +
                                '                        </div>\n' +
                                '                        <div style="display: flex;justify-content: space-between;align-items: center;padding: 15px;padding-top: 0px;padding-bottom: 20px;">\n' +
                                '\n' +
                                '                                <div id="card_time_' + data.data.list.data[j].id + '">有效期: ' + data.data.list.data[j].time + '</div>\n' +
                                '                            <div id="card_total_' + data.data.list.data[j].id + '">' + data.data.list.data[j].total + ' 次</div>\n' +
                                '                        </div>\n' +
                                '\n' +
                                '                        <div style="display: flex;justify-content: space-between;align-items: center;padding: 10px 15px;background: red;color: #FFF;border-radius: 0 0 10px 10px;">\n' +
                                '                            <div id="card_type_name_' + data.data.list.data[j].id + '">' + data.data.list.data[j].type_name + '</div>\n' +
                                '                            <div>' +
                                '<input id="min_' + data.data.list.data[j].id + '" name="" type="button" value="-" onclick="mina_card(' + data.data.list.data[j].id + ')"  style="width: 35px;height: 35px;border-radius: 50%;border: none;font-size: 25px;color: red"/>\n' +
                                '                    <input id="text_box_card_' + data.data.list.data[j].id + '" name="sku[' + data.data.list.data[j].id + '][num]" class="text_box_' + data.data.list.data[j].id + '" type="text" value="0"  style="width: 35px;outline:none;height: 35px;border: none;font-size: 25px;text-align: center" readonly/>\n' +
                                '                    <input id="add_' + data.data.list.data[j].id + '" name="" type="button" value="+" onclick="add_card(' + data.data.list.data[j].id + ')" style="width: 35px;height: 35px;border-radius: 50%;border: none;font-size: 25px;color: red"/></div>\n' +
                                '                        </div>\n' +
                                '\n' +
                                '\n' +
                                '                    </div>\n' +
                                '\n' +
                                '                    \n';
                        }
                        html += '</div>';
                    } else {
                        for (var j = 0; j < data.data.list.data.length; j++) {
                            html +=
                                '                    <div class="nr" data-id="' + data.data.list.data[j].id + '">\n' +
                                '                        <img src="' + data.data.list.data[j].image + '" alt="" >\n' +
                                '                        <div class="nrcon">\n' +
                                '                            <div>' + data.data.list.data[j].title + '</div>\n' +
                                '                            <div style="margin-top: 6px;color: red">' + data.data.list.data[j].price + '</div>\n' +
                                '                        </div>\n' +
                                '                    </div>\n' +
                                '                ';
                        }
                    }

                }
                $('.connrR').html(html);
            }
        })

    });
    $(document).on('click', '.nr', function () {
        var id = $(this).data('id');
        layer.open({
            type: 2,
            title: '选择规格',
            shadeClose: true,
            btnAlign: 'c',
            shade: 0.8,
            area: ['40%', '50%'],
            btn: ['确认选择'],
            content: 'specifications?id=' + id, //iframe的url
            success: function (layero, index) {
                layero.find('.layui-layer-title').css('text-align', 'center');
                layero.find('.layui-layer-title').css('padding-left', '0');
                $(layero).find(".layui-layer-btn0").css({
                    "width": "200px",
                    "border": "none",
                    "outline": "none",
                    "border-radius": "10px",
                    "background-color": "red", // 灰色背景
                });
            },
            yes: function (index, layero) {
                var body = layero.find("iframe").contents().find("body");
                var vals = $(body).find('#sku-form').serializeArray();
                //    var data = $("#sku-form",layero).serializeArray();
                var aa = parseToSkuArray(vals);
                console.log(aa)
                var data = sessionStorage.getItem('myArray');
                if (data == null  || data  == '') {
                    data = [];
                } else {
                    data = JSON.parse(data);
                }

                //
                //  data.push(aa);
                var ab = $.merge(data, aa);
                // 序列化数组
                let serializedArray = JSON.stringify(ab);
                //
                // // 存储到 sessionStorage
                sessionStorage.setItem('myArray', serializedArray);
                var total = 0;
                var goodHtml = '';
                for (var j = 0; j < ab.length; j++) {
                    if (ab[j].type == 'good') {
                        goodHtml += '<div class="product-card">\n' +
                            '                    <img src="' + ab[j].image + '"  class="product-image">\n' +
                            '                    <div class="product-details">\n' +
                            '                        <p class="product-name">' + ab[j].goods_title + '</p>\n' +
                            '                        <p class="product-price">' + ab[j].price + '</p>\n' +
                            '                        <p class="product-specs">规格：' + ab[j].title + '</p>\n' +
                            '                        <div class="quantity-control">\n' +
                            '                            <button id="min_' + j + '" onclick="mina(' + j + ')">-</button>\n' +
                            '                            <input type="text" id="text_box_' + j + '"  value="' + ab[j].num + '" readonly>\n' +
                            '                            <button onclick="add(' + j + ')">+</button>\n' +
                            '                        </div>\n' +
                            '                    </div><a onclick="save_good_price(' + j + ')" herf="#" style="font-size: 12px;">改价</a>' +
                            '<a style="font-size: 12px;padding-left: 10px;" herf="#" onclick="del_good(' + j + ')">删除</a>' +
                            '                </div>' +
                            '<div style="display: flex;font-size:10px;padding: 10px 0;margin:0 10px;justify-content: space-between;align-items: center;border-top:1px solid #AAAAAA ;">' +
                            '<div style="display: flex;align-items: center" onclick="choose_staff(' + j + ')"><img style="width: 30px;height: 30px;border-radius: 50%;background: #000;" src="../../uploads/20241204/1c8cd8f2070ab5926ffef8020837cec5.jpg" alt=""><div style="margin-left: 10px;">包子（美容师）</div>' +
                            '<svg t="1734418429727" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7786" width="10" height="10"><path d="M693.333333 512c0 14.933333-4.266667 29.866667-14.933333 40.533333l-234.666667 277.333334c-23.466667 27.733333-64 29.866667-89.6 8.533333-27.733333-23.466667-29.866667-64-8.533333-89.6L546.133333 512l-200.533333-236.8c-23.466667-27.733333-19.2-68.266667 8.533333-89.6 27.733333-23.466667 68.266667-19.2 89.6 8.533333l234.666667 277.333334c10.666667 10.666667 14.933333 25.6 14.933333 40.533333z" fill="#bfbfbf" p-id="7787"></path></svg>' +
                            '</div>' +
                            '<div style="display: flex;align-items: center"  onclick="choose_card(' + j + ',' + data[j].sku_id + ')"><div>选择权益卡</div><svg t="1734418625535" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10544" width="10" height="10"><path d="M573.056 752l308.8-404.608A76.8 76.8 0 0 0 820.736 224H203.232a76.8 76.8 0 0 0-61.056 123.392L450.976 752a76.8 76.8 0 0 0 122.08 0z" p-id="10545" fill="#bfbfbf"></path></svg></div></div>' +
                            '</div>';
                        total += ab[j].num * ab[j].price;
                    }

                }

                $('#goodList').html(goodHtml);
                total = formatNumber(total);
                $('#totalh').show();
                $('#cardtotalh').hide();
                $('#total').html(total);
                layer.close(index); // 点击确定按钮后关闭弹窗
            },
        });
    })

    function del_good(k) {
        var data = sessionStorage.getItem('myArray');
        var data = JSON.parse(data)
        var total = 0;
        console.log(data.length)
        console.log(k)
        for (var j = 0; j < data.length; j++) {
            if (j == k) {
                data.splice(j, 1);
            } else {
                total += data[j].num * data[j].price;
            }
        }
        let serializedArray = JSON.stringify(data);
        sessionStorage.setItem('myArray', serializedArray);
        var data = sessionStorage.getItem('myArray');

        if (data == null  || data  == '') {
            data = [];
        } else {
            data = JSON.parse(data);
            var goodHtml = '';
            var total = 0;
            for (var j = 0; j < data.length; j++) {
                if (data[j].type == 'good') {
                    goodHtml += '<div style=" border: 1px solid #e0e0e0; border-radius: 5px;"><div class="product-card">\n' +
                        '                    <img src="' + data[j].image + '"  class="product-image">\n' +
                        '                    <div class="product-details">\n' +
                        '                        <p class="product-name">' + data[j].goods_title + '</p>\n' +
                        '                        <p class="product-price">' + data[j].price + '</p>\n' +
                        '                        <p class="product-specs">规格：' + data[j].title + '</p>\n' +
                        '                        <div class="quantity-control">\n' +
                        '                            <button id="min_' + j + '" onclick="mina(' + j + ')">-</button>\n' +
                        '                            <input type="text" id="text_box_' + j + '"  value="' + data[j].num + '" readonly>\n' +
                        '                            <button onclick="add(' + j + ')">+</button>\n' +
                        '                        </div></div><a onclick="save_good_price(' + j + ')" herf="#" style="font-size: 12px;">改价</a>' +
                        '<a style="font-size: 12px;padding-left: 10px;" herf="#" onclick="del_good(' + j + ')">删除</a>' +
                        '</div>' +
                        '<div style="display: flex;font-size:10px;padding: 10px 0;margin:0 10px;justify-content: space-between;align-items: center;border-top:1px solid #AAAAAA ;">' +
                        '<div style="display: flex;align-items: center" onclick="choose_staff(' + j + ')"><img style="width: 30px;height: 30px;border-radius: 50%;background: #000;" src="../../uploads/20241204/1c8cd8f2070ab5926ffef8020837cec5.jpg" alt=""><div style="margin-left: 10px;">包子（美容师）</div>' +
                        '<svg t="1734418429727" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7786" width="10" height="10"><path d="M693.333333 512c0 14.933333-4.266667 29.866667-14.933333 40.533333l-234.666667 277.333334c-23.466667 27.733333-64 29.866667-89.6 8.533333-27.733333-23.466667-29.866667-64-8.533333-89.6L546.133333 512l-200.533333-236.8c-23.466667-27.733333-19.2-68.266667 8.533333-89.6 27.733333-23.466667 68.266667-19.2 89.6 8.533333l234.666667 277.333334c10.666667 10.666667 14.933333 25.6 14.933333 40.533333z" fill="#bfbfbf" p-id="7787"></path></svg>' +
                        '</div>' +
                        '<div style="display: flex;align-items: center"  onclick="choose_card(' + j + ',' + data[j].sku_id + ')"><div>选择权益卡</div><svg t="1734418625535" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10544" width="10" height="10"><path d="M573.056 752l308.8-404.608A76.8 76.8 0 0 0 820.736 224H203.232a76.8 76.8 0 0 0-61.056 123.392L450.976 752a76.8 76.8 0 0 0 122.08 0z" p-id="10545" fill="#bfbfbf"></path></svg></div></div>' +
                        '</div>';
                }

                total += data[j].num * data[j].price;
            }
            $('#goodList').html(goodHtml);
            total = formatNumber(total);
            $('#totalh').show();
            $('#cardtotalh').hide();
            $('#total').html(total);
        }
    }

    function parseToSkuArray(data) {
        let skuMap = {};
        let skuArray = [];

        data.forEach(item => {
            const [, skuIndex, field] = item.name.match(/^sku\[(\d+)\]\[(.+)\]$/);
            if (!skuMap[skuIndex]) {
                skuMap[skuIndex] = {};
            }
            skuMap[skuIndex][field] = item.value;

            // 检查是否已经处理了 'num' 字段
            if (field === 'num') {
                // 如果 'num' 为 '0'，不将其添加到 skuArray
                if (item.value !== '0') {
                    skuArray.push(skuMap[skuIndex]);
                    // 清空当前 skuIndex 的数据，以便下一个 SKU 可以被正确处理
                    skuMap[skuIndex] = {};
                }
            }
        });

        return skuArray;
    }

    function add(k) {
        var t = $("#text_box_" + k);
        t.val(Math.abs(parseInt(t.val())) + 1);
        if (parseInt(t.val()) != 1) {
            $('#min_' + k).attr('disabled', false);
        }
        var total = 0;
        var data = sessionStorage.getItem('myArray');
        console.log(data)
        if (data == null || data  == '') {
            data = [];
        } else {
            data = JSON.parse(data);
            for (var j = 0; j < data.length; j++) {
                console.log(j)
                console.log(k)
                if (j == k) {
                    data[j].num = t.val();
                }
                total += data[j].num * data[j].price;
            }
            let serializedArray = JSON.stringify(data);
            //
            // // 存储到 sessionStorage
            sessionStorage.setItem('myArray', serializedArray);
            total = formatNumber(total);
            $('#totalh').show();
            $('#cardtotalh').hide();
            $('#total').html(total);

        }

    }

    function mina(k) {
        var t = $("#text_box_" + k);
        var data = sessionStorage.getItem('myArray');
        data = JSON.parse(data);
        if (Math.abs(parseInt(t.val())) - 1 == 0) {
            // 删除 sessionStorage 中的数据
            data.splice(k, 1);
            let serializedArray = JSON.stringify(data);
            //
            // // 存储到 sessionStorage
            sessionStorage.setItem('myArray', serializedArray);
            var data = sessionStorage.getItem('myArray');
            if (data == null  || data  == '') {
                data = [];
            } else {
                data = JSON.parse(data);
                var goodHtml = '';
                var total = 0;
                for (var j = 0; j < data.length; j++) {
                    if (data[j].type == 'good') {
                        goodHtml += '<div style=" border: 1px solid #e0e0e0; border-radius: 5px;"><div class="product-card">\n' +
                            '                    <img src="' + data[j].image + '"  class="product-image">\n' +
                            '                    <div class="product-details">\n' +
                            '                        <p class="product-name">' + data[j].goods_title + '</p>\n' +
                            '                        <p class="product-price">' + data[j].price + '</p>\n' +
                            '                        <p class="product-specs">规格：' + data[j].title + '</p>\n' +
                            '                        <div class="quantity-control">\n' +
                            '                            <button id="min_' + j + '" onclick="mina(' + j + ')">-</button>\n' +
                            '                            <input type="text" id="text_box_' + j + '"  value="' + data[j].num + '" readonly>\n' +
                            '                            <button onclick="add(' + j + ')">+</button>\n' +
                            '                        </div></div><a onclick="save_good_price(' + j + ')" herf="#" style="font-size: 12px;">改价</a>' +
                            '<a style="font-size: 12px;padding-left: 10px;" herf="#" onclick="del_good(' + j + ')">删除</a>' +
                            '</div>' +
                            '<div style="display: flex;font-size:10px;padding: 10px 0;margin:0 10px;justify-content: space-between;align-items: center;border-top:1px solid #AAAAAA ;">' +
                            '<div style="display: flex;align-items: center" onclick="choose_staff(' + j + ')"><img style="width: 30px;height: 30px;border-radius: 50%;background: #000;" src="../../uploads/20241204/1c8cd8f2070ab5926ffef8020837cec5.jpg" alt=""><div style="margin-left: 10px;">包子（美容师）</div>' +
                            '<svg t="1734418429727" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7786" width="10" height="10"><path d="M693.333333 512c0 14.933333-4.266667 29.866667-14.933333 40.533333l-234.666667 277.333334c-23.466667 27.733333-64 29.866667-89.6 8.533333-27.733333-23.466667-29.866667-64-8.533333-89.6L546.133333 512l-200.533333-236.8c-23.466667-27.733333-19.2-68.266667 8.533333-89.6 27.733333-23.466667 68.266667-19.2 89.6 8.533333l234.666667 277.333334c10.666667 10.666667 14.933333 25.6 14.933333 40.533333z" fill="#bfbfbf" p-id="7787"></path></svg>' +
                            '</div>' +
                            '<div style="display: flex;align-items: center"  onclick="choose_card(' + j + ',' + data[j].sku_id + ')"><div>选择权益卡</div><svg t="1734418625535" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10544" width="10" height="10"><path d="M573.056 752l308.8-404.608A76.8 76.8 0 0 0 820.736 224H203.232a76.8 76.8 0 0 0-61.056 123.392L450.976 752a76.8 76.8 0 0 0 122.08 0z" p-id="10545" fill="#bfbfbf"></path></svg></div></div>' +
                            '</div>';
                    }

                    total += data[j].num * data[j].price;
                }
                $('#goodList').html(goodHtml);
                total = formatNumber(total);
                $('#totalh').show();
                $('#cardtotalh').hide();
                $('#total').html(total);
            }

        } else {
            t.val(Math.abs(parseInt(t.val())) - 1);
            // if (parseInt(t.val()) == 1) {
            //     $('#min_' + k).attr('disabled', true);
            // }
            var total = 0;

            if (data == null || data  == '') {
                data = [];
            } else {
                for (var j = 0; j < data.length; j++) {
                    if (j == k) {
                        data[j].num = t.val();
                    }
                    total += data[j].num * data[j].price;
                }
                let serializedArray = JSON.stringify(data);
                //
                // // 存储到 sessionStorage
                sessionStorage.setItem('myArray', serializedArray);
                total = formatNumber(total);
                $('#totalh').show();
                $('#cardtotalh').hide();
                $('#total').html(total);
            }
        }

    }

    function add_card(k) {
        var t = $("#text_box_card_" + k);
        t.val(Math.abs(parseInt(t.val())) + 1);
        if (parseInt(t.val()) != 1) {
            $('#min_card_' + k).attr('disabled', false);
        }
        var cardtotal = 0;
        var data = sessionStorage.getItem('cardArray');

        var add = true;
        if (data == null || data == '[]' || data == '') {
            data = [];
            var name = $("#card_" + k).html()
            var price = $("#card_price_" + k).html()
            var time = $("#card_time_" + k).html()
            var total = $("#card_total_" + k).html()
            var type_name = $("#card_type_name_" + k).html()
            var card = [
                {
                    'type': 'card',
                    'id': k,
                    'num': t.val(),
                    'title': name,
                    'service': $("#card_service_" + k).html(),
                    'price': price,
                    'time': time,
                    'total': total,
                    'type_name': type_name,
                },
            ];

            var ab = $.merge(data, card);

            // // 序列化数组
            let serializedArray = JSON.stringify(ab);
            // 存储到 sessionStorage
            sessionStorage.setItem('cardArray', serializedArray);
        } else {
            var data = JSON.parse(data)
            var card = [];
            for (var j = 0; j < data.length; j++) {
                if (data[j].id == k && data[j].type == 'card') {
                    data[j].num = addNumbers(data[j].num, 1);
                    var add = false;
                } else {
                    var name = $("#card_" + k).html()
                    var price = $("#card_price_" + k).html()
                    var time = $("#card_time_" + k).html()
                    var total = $("#card_total_" + k).html()
                    var type_name = $("#card_type_name_" + k).html()
                    var card = [
                        {
                            'type': 'card',
                            'id': k,
                            'num': t.val(),
                            'title': name,
                            'service': $("#card_service_" + k).html(),
                            'price': price,
                            'time': time,
                            'total': total,
                            'type_name': type_name,
                        },
                    ];
                    if (add !== false) {
                        add = true;
                    }
                }
                cardtotal += data[j].num * data[j].price;
            }
            if (card.length > 0 && add) {
                var data = $.merge(data, card);
            }
            // 序列化数组
            let serializedArray = JSON.stringify(data);
            // 存储到 sessionStorage
            sessionStorage.setItem('cardArray', serializedArray);
        }
        cardtotal = formatNumber(cardtotal);
        //  $('#total').html(total);
        // 页面静态刷新
        var cardHtml = '';
        var data = sessionStorage.getItem('cardArray');
        console.log(data)
        if (data == null|| data == '') {
            data = [];
        } else {
            data = JSON.parse(data);
            console.log(data)
            for (var j = 0; j < data.length; j++) {

                if (data[j].type == 'card') {
                    // 卡项
                    cardHtml += '<div style="border-radius: 10px;border: 1px solid red;margin-top: 10px;">\n' +
                        '                    <div style="display: flex;justify-content: space-between;align-items: center;padding: 15px;padding-bottom: 10px;font-size: 14px;">\n' +
                        '                        <div>\n' +
                        '                            <div >' + data[j].title + '</div>\n' +
                        '                            <div >' + data[j].service + '</div>\n' +
                        '                        </div>\n' +
                        '                        <div>¥ ' + data[j].price + '</div>\n' +
                        '                    </div>\n' +
                        '                    <div style="display: flex;justify-content: space-between;align-items: center;padding: 15px;padding-top: 0px;padding-bottom: 20px;font-size: 14px;">\n' +
                        '\n' +
                        '                        <div>' + data[j].time + ' </div>\n' +
                        '                        <div>' + data[j].total + '</div>\n' +
                        '                    </div>\n' +
                        '                    <div style="font-size: 14px;display: flex;justify-content: space-between;align-items: center;padding: 10px 15px;background: red;color: #FFF;border-radius: 0 0 10px 10px;">\n' +
                        '                        <div>' + data[j].type_name + '</div>\n' +
                        '                        <div> <input id="min_card_' + data[j].id + '" name="" type="button" value="-" onclick="mina_card_list(' + data[j].id + ')"  style="width: 35px;height: 35px;border-radius: 50%;border: none;font-size: 25px;color: red"/>\n' +
                        '                    <input id="text_card_list_' + data[j].id + '" name="card[' + data[j].id + '][num]" type="text" value="' + data[j].num + '"  style="width: 35px;outline:none;height: 35px;border: none;font-size: 25px;text-align: center" readonly/>\n' +
                        '                    <input id="add_card_' + data[j].id + '" name="" type="button" value="+" onclick="add_card_list(' + data[j].id + ')" style="width: 35px;height: 35px;border-radius: 50%;border: none;font-size: 25px;color: red"/></div>\n' +
                        '                    </div>\n' +
                        '                </div>';
                }
                // console.log(data[j].num)
                // console.log(data[j].price)
                // total += data[j].num * data[j].price;
            }
            $('#totalh').hide();
            $('#cardtotalh').show();
            $('#cardtotal').html(cardtotal);
            $('#cardList').html(cardHtml);
        }
    }

    function mina_card(k) {
        console.log()
        var t = $("#text_box_card_" + k);
        console.log(parseInt(t.val()) == 0)
        if (parseInt(t.val()) == 0) {
            $('#min_card_' + k).attr('disabled', false);
            t.val(0)
            //  $('#text_box_card_' + k).attr('disabled', true);
        } else {
            t.val(Math.abs(parseInt(t.val())) - 1);
        }

        console.log(k)
    }

    function choose_card(k, skuid) {
        console.log(k)
        console.log(skuid)
        var data = sessionStorage.getItem('myArray');
        var data = JSON.parse(data)
        var ids = '';
        for (var j = 0; j < data.length; j++) {
            if (data[j].type == 'card') {
                ids += data[j]['id'] + ',';
            }
        }
        ids = ids.substring(0, ids.lastIndexOf(','));
        var id = k
        layer.open({
            type: 2,
            title: '选择权益卡',
            shadeClose: true,
            btnAlign: 'c',
            shade: 0.8,
            area: ['30%', '50%'],
            btn: ['确认'],
            content: 'choosecard?id=' + id + '&skuid=' + skuid + '&cardid=' + ids + '&num=' + data[k].num + '&price=' + data[k].price, //iframe的url
            success: function (layero, index) {
                layero.find('.layui-layer-title').css('text-align', 'center');
                layero.find('.layui-layer-title').css('padding-left', '0');
                $(layero).find(".layui-layer-btn0").css({
                    "width": "200px",
                    "border": "none",
                    "outline": "none",
                    "border-radius": "10px",
                    "background-color": "red", // 灰色背景
                });
            },
            yes: function (index, layero) {
                layer.close(index); // 点击确定按钮后关闭弹窗
            },
        });
    }

    function formatNumber(num) {
        return parseFloat(num).toFixed(2);
    }

    function addNumbers(num1, num2) {
        return parseFloat(num1) + parseFloat(num2);
    }

    function save_good_price(k) {
        // good 商品改价
        layer.open({
            type: 1,
            title: '商品改价',
            shadeClose: true,
            btnAlign: 'c',
            area: ['30%', '20%'],
            content: ' <div class="row" style="width: 100%;">'
                + '<div class="col-sm-12" style="padding: 10px;">'
                + '<div class="input-group">'
                + '<span class="input-group-addon"> 改动价  :    </span>'
                + '<input style="height: 20px;width: 70%" type="number" class="form-control" name="price" value="">'
                + '</div>'
                + '</div>'
                + '</div>'
            ,
            btn: ['确认'],
            success: function (layero, index) {
                layero.find('.layui-layer-title').css('text-align', 'center');
                layero.find('.layui-layer-title').css('padding-left', '0');
                $(layero).find(".layui-layer-btn0").css({
                    "width": "100px",
                    "border": "none",
                    "outline": "none",
                    "border-radius": "10px",
                    "background-color": "red", // 灰色背景
                });
            },
            yes: function (index, layero) {
                var data = sessionStorage.getItem('myArray');
                var data = JSON.parse(data)
                var total = 0;
                var price = $("input[name='price']").val();
                for (var j = 0; j < data.length; j++) {
                    if (j == k) {
                        data[j].old_price = formatNumber(data[j].price);
                        data[j].save_price = formatNumber(data[j].old_price - price);
                        data[j].price = formatNumber(price);
                    }
                    total += data[j].num * data[j].price;
                }
                let serializedArray = JSON.stringify(data);
                sessionStorage.setItem('myArray', serializedArray);
                var data = sessionStorage.getItem('myArray');

                if (data == null || data == '') {
                    data = [];
                } else {
                    data = JSON.parse(data);
                    var goodHtml = '';
                    var total = 0;
                    for (var j = 0; j < data.length; j++) {
                        if (data[j].type == 'good') {
                            goodHtml += '<div style=" border: 1px solid #e0e0e0; border-radius: 5px;"><div class="product-card">\n' +
                                '                    <img src="' + data[j].image + '"  class="product-image">\n' +
                                '                    <div class="product-details">\n' +
                                '                        <p class="product-name">' + data[j].goods_title + '</p>\n' +
                                '                        <p class="product-price">' + data[j].price + '</p>\n' +
                                '                        <p class="product-specs">规格：' + data[j].title + '</p>\n' +
                                '                        <div class="quantity-control">\n' +
                                '                            <button id="min_' + j + '" onclick="mina(' + j + ')">-</button>\n' +
                                '                            <input type="text" id="text_box_' + j + '"  value="' + data[j].num + '" readonly>\n' +
                                '                            <button onclick="add(' + j + ')">+</button>\n' +
                                '                        </div></div><a onclick="save_good_price(' + j + ')" herf="#" style="font-size: 12px;">改价</a>' +
                                '<a style="font-size: 12px;padding-left: 10px;" herf="#" onclick="del_good(' + j + ')">删除</a>' +
                                '</div>' +
                                '<div style="display: flex;font-size:10px;padding: 10px 0;margin:0 10px;justify-content: space-between;align-items: center;border-top:1px solid #AAAAAA ;">' +
                                '<div style="display: flex;align-items: center" onclick="choose_staff(' + j + ')"><img style="width: 30px;height: 30px;border-radius: 50%;background: #000;" src="../../uploads/20241204/1c8cd8f2070ab5926ffef8020837cec5.jpg" alt=""><div style="margin-left: 10px;">包子（美容师）</div>' +
                                '<svg t="1734418429727" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7786" width="10" height="10"><path d="M693.333333 512c0 14.933333-4.266667 29.866667-14.933333 40.533333l-234.666667 277.333334c-23.466667 27.733333-64 29.866667-89.6 8.533333-27.733333-23.466667-29.866667-64-8.533333-89.6L546.133333 512l-200.533333-236.8c-23.466667-27.733333-19.2-68.266667 8.533333-89.6 27.733333-23.466667 68.266667-19.2 89.6 8.533333l234.666667 277.333334c10.666667 10.666667 14.933333 25.6 14.933333 40.533333z" fill="#bfbfbf" p-id="7787"></path></svg>' +
                                '</div>' +
                                '<div style="display: flex;align-items: center"  onclick="choose_card(' + j + ',' + data[j].sku_id + ')"><div>选择权益卡</div><svg t="1734418625535" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10544" width="10" height="10"><path d="M573.056 752l308.8-404.608A76.8 76.8 0 0 0 820.736 224H203.232a76.8 76.8 0 0 0-61.056 123.392L450.976 752a76.8 76.8 0 0 0 122.08 0z" p-id="10545" fill="#bfbfbf"></path></svg></div></div>' +
                                '</div>';
                        }

                        total += data[j].num * data[j].price;
                    }
                    $('#goodList').html(goodHtml);
                    total = formatNumber(total);
                    $('#totalh').show();
                    $('#cardtotalh').hide();
                    $('#total').html(total);
                }

                layer.close(index); // 点击确定按钮后关闭弹窗
            },
        });

    }

    function add_card_list(k) {
        var t = $("#text_card_list_" + k);
        t.val(Math.abs(parseInt(t.val())) + 1);
        var cardtotal = 0;
        var data = sessionStorage.getItem('cardArray');
        var data = JSON.parse(data)
        for (var j = 0; j < data.length; j++) {
            if (data[j].id == k && data[j].type == 'card') {
                data[j].num = t.val();
            }
            cardtotal += data[j].num * data[j].price;
        }
        let serializedArray = JSON.stringify(data);
        // 存储到 sessionStorage
        sessionStorage.setItem('cardArray', serializedArray);
        cardtotal = formatNumber(cardtotal);
        $('#totalh').hide();
        $('#cardtotalh').show();
        $('#cardtotal').html(cardtotal);
        var cardHtml = '';
        var data = sessionStorage.getItem('cardArray');
        if (data == null || data == '') {
            data = [];
        } else {
            data = JSON.parse(data);
            for (var j = 0; j < data.length; j++) {

                if (data[j].type == 'card') {
                    // 卡项
                    cardHtml += '<div style="border-radius: 10px;border: 1px solid red;margin-top: 10px;">\n' +
                        '                    <div style="display: flex;justify-content: space-between;align-items: center;padding: 15px;padding-bottom: 10px;font-size: 14px;">\n' +
                        '                        <div>\n' +
                        '                            <div >' + data[j].title + '</div>\n' +
                        '                            <div >' + data[j].service + '</div>\n' +
                        '                        </div>\n' +
                        '                        <div>¥ ' + data[j].price + '</div>\n' +
                        '                    </div>\n' +
                        '                    <div style="display: flex;justify-content: space-between;align-items: center;padding: 15px;padding-top: 0px;padding-bottom: 20px;font-size: 14px;">\n' +
                        '\n' +
                        '                        <div>' + data[j].time + ' </div>\n' +
                        '                        <div>' + data[j].total + '</div>\n' +
                        '                    </div>\n' +
                        '                    <div style="font-size: 14px;display: flex;justify-content: space-between;align-items: center;padding: 10px 15px;background: red;color: #FFF;border-radius: 0 0 10px 10px;">\n' +
                        '                        <div>' + data[j].type_name + '</div>\n' +
                        '                        <div> <input id="min_card_' + data[j].id + '" name="" type="button" value="-" onclick="mina_card_list(' + data[j].id + ')"  style="width: 35px;height: 35px;border-radius: 50%;border: none;font-size: 25px;color: red"/>\n' +
                        '                    <input id="text_card_list_' + data[j].id + '" name="card[' + data[j].id + '][num]" type="text" value="' + data[j].num + '"  style="width: 35px;outline:none;height: 35px;border: none;font-size: 25px;text-align: center" readonly/>\n' +
                        '                    <input id="add_card_' + data[j].id + '" name="" type="button" value="+" onclick="add_card_list(' + data[j].id + ')" style="width: 35px;height: 35px;border-radius: 50%;border: none;font-size: 25px;color: red"/></div>\n' +
                        '                    </div>\n' +
                        '                </div>';
                }

                total += data[j].num * data[j].price;
            }
            $('#cardList').html(cardHtml);
        }
    }

    function mina_card_list(k) {
        var t = $("#text_card_list_" + k);
        var cardtotal = 0;
        var data = sessionStorage.getItem('cardArray');
        var data = JSON.parse(data)
        if (Math.abs(parseInt(t.val())) - 1 == 0) {
            // 删除卡项
            for (var j = 0; j < data.length; j++) {
                if (data[j].id == k && data[j].type == 'card') {
                    data.splice(j, 1);
                }
                if (data.length > 1) {
                    cardtotal += data[j].num * data[j].price;
                }
            }
        } else {
            t.val(Math.abs(parseInt(t.val())) - 1);
            for (var j = 0; j < data.length; j++) {
                if (data[j].id == k && data[j].type == 'card') {
                    data[j].num = t.val();
                }
                cardtotal += data[j].num * data[j].price;
            }
        }
        let serializedArray = JSON.stringify(data);
        // 存储到 sessionStorage
        sessionStorage.setItem('cardArray', serializedArray);
        cardtotal = formatNumber(cardtotal);
        $('#totalh').hide();
        $('#cardtotalh').show();
        $('#cardtotal').html(cardtotal);
        var cardHtml = '';
        var data = sessionStorage.getItem('cardArray');
        if (data == null || data == '') {
            data = [];
        } else {
            data = JSON.parse(data);
            console.log(data)
            for (var j = 0; j < data.length; j++) {

                if (data[j].type == 'card') {
                    // 卡项
                    cardHtml += '<div style="border-radius: 10px;border: 1px solid red;margin-top: 10px;">\n' +
                        '                    <div style="display: flex;justify-content: space-between;align-items: center;padding: 15px;padding-bottom: 10px;font-size: 14px;">\n' +
                        '                        <div>\n' +
                        '                            <div >' + data[j].title + '</div>\n' +
                        '                            <div >' + data[j].service + '</div>\n' +
                        '                        </div>\n' +
                        '                        <div>¥ ' + data[j].price + '</div>\n' +
                        '                    </div>\n' +
                        '                    <div style="display: flex;justify-content: space-between;align-items: center;padding: 15px;padding-top: 0px;padding-bottom: 20px;font-size: 14px;">\n' +
                        '\n' +
                        '                        <div>' + data[j].time + ' </div>\n' +
                        '                        <div>' + data[j].total + '</div>\n' +
                        '                    </div>\n' +
                        '                    <div style="font-size: 14px;display: flex;justify-content: space-between;align-items: center;padding: 10px 15px;background: red;color: #FFF;border-radius: 0 0 10px 10px;">\n' +
                        '                        <div>' + data[j].type_name + '</div>\n' +
                        '                        <div> <input id="min_card_' + data[j].id + '" name="" type="button" value="-" onclick="mina_card_list(' + data[j].id + ')"  style="width: 35px;height: 35px;border-radius: 50%;border: none;font-size: 25px;color: red"/>\n' +
                        '                    <input id="text_card_list_' + data[j].id + '" name="card[' + data[j].id + '][num]" type="text" value="' + data[j].num + '"  style="width: 35px;outline:none;height: 35px;border: none;font-size: 25px;text-align: center" readonly/>\n' +
                        '                    <input id="add_card_' + data[j].id + '" name="" type="button" value="+" onclick="add_card_list(' + data[j].id + ')" style="width: 35px;height: 35px;border-radius: 50%;border: none;font-size: 25px;color: red"/></div>\n' +
                        '                    </div>\n' +
                        '                </div>';
                }

                cardtotal += data[j].num * data[j].price;
            }
            $('#cardList').html(cardHtml);
        }
    }

    function goodsclean() {
        var isVisible = $('#goodList').is(":visible");
        // console.log(isVisible); // 输出：false，因为div是隐藏的
        if (isVisible) {
            sessionStorage.removeItem('myArray');
            $('#goodList').html('');
            $('#total').html('0.00');
        }
        var cardisVisible = $('#cardList').is(":visible");
        if (cardisVisible) {
            sessionStorage.removeItem('cardArray');
            $('#cardList').html('');
            $('#cardtotal').html('0.00');
        }
    }

    function create_order() {
        var isVisible = $('#goodList').is(":visible");
        var cardisVisible = $('#cardList').is(":visible");
        var username =   sessionStorage.getItem('username');
        username = JSON.parse(username);
        if(username == null){
            alert('请选择客户');
            return;
        }else{
            getcoupon()
        }
        $('.con').hide(); // 隐藏元素
        $('.right').hide(); // 隐藏元素
        $("#cashier").show();
        var total = 0
        var save_totals = 0
        var vip_total = 0


        if (isVisible) {
            // 商品订单
            getuseCard()
            var data = sessionStorage.getItem('myArray');
            if (data == null || data == '[]') {
                alert('请选择卡项');
                return;
            }
            var data = JSON.parse(data)
            console.log(data)
            for(var j = 0; j < data.length; j++){
                total +=  data[j].price * data[j].num
                if (data[j].save_price > 0){
                    save_totals +=  data[j].save_price * data[j].num
                }
            }

            $("#totalzongji").html( '¥ '+formatNumber(total))
            sessionStorage.setItem('total',total)
            console.log(save_totals)
            $("#yijiazongji").html( '-¥ '+formatNumber(save_totals))
            sessionStorage.setItem('save_totals',save_totals)
            $("#vip_total").html( '¥ '+formatNumber(vip_total))
            sessionStorage.setItem('vip_total',vip_total)
        }
        if (cardisVisible) {

            // 卡订单
            var data = sessionStorage.getItem('cardArray');
            if (data == null || data == '[]') {
                alert('请选择卡项');
                return;
            }
            var data = JSON.parse(data)
            for(var j = 0; j < data.length; j++){
                total +=  data[j].price * data[j].num
            }
            $("#totalzongji").html('¥ '+formatNumber(total))
            sessionStorage.setItem(total,total)
            $("#yijiazongji").html( '¥ -'+formatNumber(0))
            sessionStorage.setItem(save_totals,0)
            $("#vip_total").html( '¥ '+formatNumber(vip_total))
            sessionStorage.setItem(vip_total,vip_total)
            $.ajax({
                type: 'post',
                url: 'cardOrder',
                data: {data: data},
                dataType: 'json',
                success: function (data) {
                    if (data.order_id > 0) {
                        // 跳转页面
                    }
                }
            })
            console.log(data)
        }
        get_total_zongji()
    }
    function back(){
        $('.con').show(); // 隐藏元素
        var username =   sessionStorage.getItem('username');
        username = JSON.parse(username);

        if (username == null){
            $('.user_show').show()
            $('.user_show_user').hide()
        }else{
            $('.user_show_user').show()
            $('.user_show').hide()
            setuser();
        }

        $('.right').show(); // 隐藏元素

        $("#cashier").hide();
    }
    function add_user(){
        layer.open({
            type: 1,
            title: '增加会员',
            shadeClose: true,
            btnAlign: 'c',
            area: ['30%', '30%'],
            content: ' <div class="row" style="width: 100%;">'
                + '<div class="col-sm-12" style="padding: 10px;">'
                + '<div class="input-group">'
                + '<span class="input-group-addon"> 会员账号  :    </span>'
                + '<input style="height: 20px;width: 70%" type="text" class="form-control" name="phone" value="">'
                + '</div>'
                + '</div>'
                + '</div>'
            ,
            btn: ['确认'],
            success: function (layero, index) {
                layero.find('.layui-layer-title').css('text-align', 'center');
                layero.find('.layui-layer-title').css('padding-left', '0');
                $(layero).find(".layui-layer-btn0").css({
                    "width": "100px",
                    "border": "none",
                    "outline": "none",
                    "border-radius": "10px",
                    "background-color": "red", // 灰色背景
                });
            },
            yes: function (index, layero) {
                 var phone = $("input[name='phone']").val();
                $.ajax({
                    type: 'post',
                    url: 'add_user',
                    data: {phone: phone},
                    dataType: 'json',
                    success: function (data) {
                        alert(data.msg)
                        if (data.msg === '添加成功'){
                            layer.close(index); // 点击确定按钮后关闭弹窗
                        }
                    },
                })

            },
        });
    }

    function userclean(){
        sessionStorage.removeItem('username');
        $('.user_show').show()
        $('.user_show_user').hide()

    }

    function choose_user(){
        layer.open({
            type: 1,
            title: '选择会员',
            shadeClose: true,
            btnAlign: 'c',
            area: ['30%', '30%'],
            content: ' <div class="row" style="width: 100%;">'
                + '<div class="col-sm-12" style="padding: 10px;">'
                + '<div class="input-group">'
                + '<span class="input-group-addon"> 会员账号  :    </span>'
                + '<input style="height: 20px;width: 70%" type="text" class="form-control" name="phone" value="">'
                + '</div>'
                + '</div>'
                + '</div>'
            ,
            btn: ['确认'],
            success: function (layero, index) {
                layero.find('.layui-layer-title').css('text-align', 'center');
                layero.find('.layui-layer-title').css('padding-left', '0');
                $(layero).find(".layui-layer-btn0").css({
                    "width": "100px",
                    "border": "none",
                    "outline": "none",
                    "border-radius": "10px",
                    "background-color": "red", // 灰色背景
                });
            },
            yes: function (index, layero) {
                var phone = $("input[name='phone']").val();
                $.ajax({
                    type: 'post',
                    url: 'choose_user',
                    data: {phone: phone},
                    dataType: 'json',
                    success: function (data) {
                        if (data.msg !== ''){
                            alert(data.msg)
                        }else{
                            let serializedArray = JSON.stringify(data.data);
                            sessionStorage.setItem('username', serializedArray);
                            setuser();
                            layer.close(index); // 点击确定按钮后关闭弹窗
                        }
                    },
                })

            },
        });
        
    }
    function setuser() {
      var  username =  sessionStorage.getItem('username')
      username = JSON.parse(username);
      $('.username').html(username.mobile)
      $('.mobile').html(username.mobile)
      $('.money').html('余额:'+ username.money)
      $('.score').html('积分:'+ username.score)
      $('.user_show_user').show()
      $('.user_show').hide()

    }
    function getcoupon() {
        var username =  sessionStorage.getItem('username')
        username = JSON.parse(username);
        var phone = username.mobile;
        $.ajax({
            type: 'post',
            url: 'getcoupon',
            data: {phone: phone},
            dataType: 'json',
            success: function (data) {
                // 渲染 卡项
                var couponHtml = '';
                if(data.data.length > 0) {
                    for (var j = 0; j < data.data.length; j++) {
                        couponHtml += '<div  class="coupon-list-set checkCopon"  data-id=" '+ data.data[j].id + '" data-price=" '+ data.data[j].price + '">\n' +
                            '                        <div style="display: flex;align-items: center;">\n' +
                            '                            <svg t="1735366738647" class="icon" viewBox="0 0 1251 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4321" width="20" height="20"><path d="M850.204444 475.591111a28.444444 28.444444 0 0 0 0-56.888889h-184.32l202.524445-166.684444a29.098667 29.098667 0 1 0-36.977778-44.942222l-212.764444 174.933333-212.764445-174.933333A28.444444 28.444444 0 1 0 369.777778 250.595556l202.524444 166.684444h-187.733333a28.444444 28.444444 0 0 0 0 56.888889h203.662222v87.324444h-203.662222a28.444444 28.444444 0 0 0 0 56.888889h203.662222V796.444444a28.444444 28.444444 0 1 0 56.888889 0v-175.502222h203.662222a28.444444 28.444444 0 0 0 0-56.888889h-202.24v-88.462222z" fill="#d4237a" p-id="4322"></path><path d="M1227.946667 371.768889l23.608889-3.982222V199.111111a199.111111 199.111111 0 0 0-199.111112-199.111111H199.111111a199.111111 199.111111 0 0 0-199.111111 199.111111v168.675556l23.608889 3.982222a142.222222 142.222222 0 0 1 0 280.462222l-23.608889 3.982222V824.888889a199.111111 199.111111 0 0 0 199.111111 199.111111h853.333333a199.111111 199.111111 0 0 0 199.111112-199.111111v-168.675556l-23.608889-3.982222a142.222222 142.222222 0 0 1 0-280.462222zM1052.444444 512a199.111111 199.111111 0 0 0 142.222223 190.862222V824.888889a142.222222 142.222222 0 0 1-142.222223 142.222222H199.111111a142.222222 142.222222 0 0 1-142.222222-142.222222v-122.026667a199.111111 199.111111 0 0 0 0-381.724444V199.111111a142.222222 142.222222 0 0 1 142.222222-142.222222h853.333333a142.222222 142.222222 0 0 1 142.222223 142.222222v122.026667A199.111111 199.111111 0 0 0 1052.444444 512z" fill="#d4237a" p-id="4323"></path></svg>\n' +
                            '                            <div style="margin-left: 10px"> ' + data.data[j].price + '元优惠券</div>\n' +
                            '                        </div>\n' +
                            '                        <div>可用</div>\n' +
                            '\n' +
                            '                    </div>'
                    }
                }else {
                    couponHtml += '<div class="coupon—list ">\n' +
                        '                        <div style="display: flex;align-items: center;">\n' +
                        '                            <svg t="1735366738647" class="icon" viewBox="0 0 1251 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4321" width="20" height="20"><path d="M850.204444 475.591111a28.444444 28.444444 0 0 0 0-56.888889h-184.32l202.524445-166.684444a29.098667 29.098667 0 1 0-36.977778-44.942222l-212.764444 174.933333-212.764445-174.933333A28.444444 28.444444 0 1 0 369.777778 250.595556l202.524444 166.684444h-187.733333a28.444444 28.444444 0 0 0 0 56.888889h203.662222v87.324444h-203.662222a28.444444 28.444444 0 0 0 0 56.888889h203.662222V796.444444a28.444444 28.444444 0 1 0 56.888889 0v-175.502222h203.662222a28.444444 28.444444 0 0 0 0-56.888889h-202.24v-88.462222z" fill="#8a8a8a" p-id="4322"></path><path d="M1227.946667 371.768889l23.608889-3.982222V199.111111a199.111111 199.111111 0 0 0-199.111112-199.111111H199.111111a199.111111 199.111111 0 0 0-199.111111 199.111111v168.675556l23.608889 3.982222a142.222222 142.222222 0 0 1 0 280.462222l-23.608889 3.982222V824.888889a199.111111 199.111111 0 0 0 199.111111 199.111111h853.333333a199.111111 199.111111 0 0 0 199.111112-199.111111v-168.675556l-23.608889-3.982222a142.222222 142.222222 0 0 1 0-280.462222zM1052.444444 512a199.111111 199.111111 0 0 0 142.222223 190.862222V824.888889a142.222222 142.222222 0 0 1-142.222223 142.222222H199.111111a142.222222 142.222222 0 0 1-142.222222-142.222222v-122.026667a199.111111 199.111111 0 0 0 0-381.724444V199.111111a142.222222 142.222222 0 0 1 142.222222-142.222222h853.333333a142.222222 142.222222 0 0 1 142.222223 142.222222v122.026667A199.111111 199.111111 0 0 0 1052.444444 512z" fill="#8a8a8a" p-id="4323"></path></svg>\n' +
                        '                            <div style="margin-left: 10px">无</div>\n' +
                        '                        </div>\n' +
                        '                      \n' +
                        '\n' +
                        '                    </div>'
                }
                $('#coupon').html(couponHtml);
            },
        })
    }

    function card_use(){
        var cardisVisible = $('#cardList').is(":visible");
        var cardList = ''
        if (cardisVisible) {
            // 卡订单

        }
    }
    // 选择优惠券
    $(document).on('click', '.checkCopon', function () {
        $(this).addClass('active-coupon').siblings().removeClass('active-coupon');
        var id =   $(this).data('id')
        var price =   $(this).data('price')
        console.log(id)
       sessionStorage.setItem('coupon_id', id);
        $("#coupon_total").html(formatNumber(price))
        sessionStorage.setItem('coupon_total',price)
        get_total_zongji()
    })

    function getuseCard(){
        var data = sessionStorage.getItem('cardList');
        var data = JSON.parse(data)
        console.log(111111)
        console.log(data)
        var card_total = 0
        var cardHtml = ''
        if (data == null || data == '[]') {

        }else{
            for (var j= 0; j < data.length; j++){
                    if (data[j].checknum > 0){
                        // 卡项
                        cardHtml += '<div style="border-radius: 10px;border: 1px solid red;margin-top: 10px;">\n' +
                            '                    <div style="display: flex;justify-content: space-between;align-items: center;padding: 15px;padding-bottom: 10px;font-size: 14px;">\n' +
                            '                        <div>\n' +
                            '                            <div >' + data[j].name + '</div>\n' +
                            '                            <div >' + data[j].card_service + '</div>\n' +
                            '                        </div>\n' +
                            '                        <div>¥ ' + data[j].price + '</div>\n' +
                            '                    </div>\n' +
                            '                    <div style="display: flex;justify-content: space-between;align-items: center;padding: 15px;padding-top: 0px;padding-bottom: 20px;font-size: 14px;">\n' +
                            '\n' +
                            '                        <div>' + data[j].time + ' </div>\n' +
                            '                        <div>' + data[j].total + '</div>\n' +
                            '                    </div>\n' +
                            '                    <div style="font-size: 14px;display: flex;justify-content: space-between;align-items: center;padding: 10px 15px;background: red;color: #FFF;border-radius: 0 0 10px 10px;">\n' +
                            '                        <div>' + data[j].type_name + '</div>\n' +
                            '                        <div>' + data[j].time + '</div>\n' +
                            '                   ' +
                            '                    ' +
                            '                    </div>\n' +
                            '                </div>';
                        card_total +=  data[j].price * data[j].checknum
                    }

                }


            $('#checkcard').html(cardHtml)
            sessionStorage.setItem('card_price_use',card_total)
            $('#card_price_use').html( '- ¥ '+ formatNumber(card_total))
        }

    }
    function get_total_zongji(){
        var total =  sessionStorage.getItem('total')
        var card_price_use =  sessionStorage.getItem('card_price_use')
        var vip_total =  sessionStorage.getItem('vip_total')
        var save_totals =  sessionStorage.getItem('save_totals')
        var  coupon_total =  sessionStorage.getItem('coupon_total')

        var paytotal =  total - card_price_use- vip_total - save_totals - coupon_total;
        if (paytotal <= 0){
            paytotal = 0
        }
        $("#paytotal").html(formatNumber(paytotal))
        $("#pay").html(formatNumber(paytotal))

    }
    function payorder(){
        alert('支付成功')
         sessionStorage.removeItem('cardArray')
         sessionStorage.removeItem('myArray')
         sessionStorage.removeItem('total')
    }

    // 关闭本单
    function closethisorder(){
        sessionStorage.removeItem('cardArray')
        sessionStorage.removeItem('myArray')
    }

    function choosemaster(){
        sessionStorage.removeItem('cardArray')
        sessionStorage.removeItem('myArray')
    }

    function choose_staff(j){
        layer.open({
            type: 2,
            title: '选择服务人员',
            shadeClose: true,
            btnAlign: 'c',
            shade: 0.8,
            area: ['30%', '50%'],
            btn: ['确认'],
            content: 'choosestaff' , //iframe的url
            success: function (layero, index) {
                layero.find('.layui-layer-title').css('text-align', 'center');
                layero.find('.layui-layer-title').css('padding-left', '0');
                $(layero).find(".layui-layer-btn0").css({
                    "width": "200px",
                    "border": "none",
                    "outline": "none",
                    "border-radius": "10px",
                    "background-color": "red", // 灰色背景
                });
            },
            yes: function (index,layero) {
                var body = layero.find("iframe").contents().find("body");
                var vals = $(body).find('#staff-form').serializeArray();
                var staff = vals[0].value;
                $.ajax({
                    type: 'post',
                    url: 'getstaff',
                    data: {staff_id: staff},
                    dataType: 'json',
                    success: function (data) {
                        var myArray = sessionStorage.getItem('myArray');
                        myArray = JSON.parse(myArray);
                        myArray[j].staff = data.data;
                        let serializedArray = JSON.stringify(data);
                        sessionStorage.setItem('myArray', serializedArray);

                        // 选择服务人员 页面渲染
                        // var data = sessionStorage.getItem('myArray');
                        //
                        // var goodHtml = '';
                        // var total = 0;
                        // for (var j = 0; j < data.length; j++) {
                        //     console.log(data[j])
                        //     if (data[j].type == 'good') {
                        //         goodHtml += '<div style=" border: 1px solid #e0e0e0; border-radius: 5px;"><div class="product-card">\n' +
                        //             '                    <img src="' + data[j].image + '"  class="product-image">\n' +
                        //             '                    <div class="product-details">\n' +
                        //             '                        <p class="product-name">' + data[j].goods_title + '</p>\n' +
                        //             '                        <p class="product-price">' + data[j].price + '</p>\n' +
                        //             '                        <p class="product-specs">规格：' + data[j].title + '</p>\n' +
                        //             '                        <div class="quantity-control">\n' +
                        //             '                            <button id="min_' + j + '" onclick="mina(' + j + ')">-</button>\n' +
                        //             '                            <input type="text" id="text_box_' + j + '"  value="' + data[j].num + '" readonly>\n' +
                        //             '                            <button onclick="add(' + j + ')">+</button>\n' +
                        //             '                        </div></div><a onclick="save_good_price(' + j + ')" herf="#" style="font-size: 12px;">改价</a>' +
                        //             '<a style="font-size: 12px;padding-left: 10px;" herf="#" onclick="del_good(' + j + ')">删除</a>' +
                        //             '</div>' +
                        //             '<div style="display: flex;font-size:10px;padding: 10px 0;margin:0 10px;justify-content: space-between;align-items: center;border-top:1px solid #AAAAAA ;">' +
                        //             '<div style="display: flex;align-items: center" onclick="choose_staff(' + j + ')">' +
                        //             '<img style="width: 30px;height: 30px;border-radius: 50%;background: #000;" src="'+ data[j][staff].portraitimage +'" alt="">' +
                        //             '<div style="margin-left: 10px;">包子（美容师）</div>' +
                        //             '<svg t="1734418429727" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7786" width="10" height="10"><path d="M693.333333 512c0 14.933333-4.266667 29.866667-14.933333 40.533333l-234.666667 277.333334c-23.466667 27.733333-64 29.866667-89.6 8.533333-27.733333-23.466667-29.866667-64-8.533333-89.6L546.133333 512l-200.533333-236.8c-23.466667-27.733333-19.2-68.266667 8.533333-89.6 27.733333-23.466667 68.266667-19.2 89.6 8.533333l234.666667 277.333334c10.666667 10.666667 14.933333 25.6 14.933333 40.533333z" fill="#bfbfbf" p-id="7787"></path></svg>' +
                        //             '</div>' +
                        //             '<div style="display: flex;align-items: center"  onclick="choose_card(' + j + ',' + data[j].sku_id + ')"><div>选择权益卡</div><svg t="1734418625535" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10544" width="10" height="10"><path d="M573.056 752l308.8-404.608A76.8 76.8 0 0 0 820.736 224H203.232a76.8 76.8 0 0 0-61.056 123.392L450.976 752a76.8 76.8 0 0 0 122.08 0z" p-id="10545" fill="#bfbfbf"></path></svg></div></div>' +
                        //             '</div>';
                        //     }
                        //
                        //     total += data[j].num * data[j].price;
                        // }
                        $('#goodList').html(goodHtml);
                        total = formatNumber(total);
                        $('#totalh').show();
                        $('#cardtotalh').hide();
                        $('#total').html(total);
                    }
                })
                layer.close(index); // 点击确定按钮后关闭弹窗
            },
        });

    }


</script>